From bc9955ab662f53593951cc79cd5505277299a9ba Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Tue, 10 May 2011 06:58:13 +0200 Subject: [PATCH] Add validation methods to preferences. --- .../java/net/pterodactylus/sone/core/Core.java | 48 ++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index 0685c9a..08cd1cc 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -2017,6 +2017,18 @@ public class Core implements IdentityListener, UpdateListener { } /** + * Validates the given insertion delay. + * + * @param insertionDelay + * The insertion delay to validate + * @return {@code true} if the given insertion delay was valid, {@code + * false} otherwise + */ + public boolean validateInsertionDelay(Integer insertionDelay) { + return options.getIntegerOption("InsertionDelay").validate(insertionDelay); + } + + /** * Sets the insertion delay * * @param insertionDelay @@ -2039,6 +2051,18 @@ public class Core implements IdentityListener, UpdateListener { } /** + * Validates the number of posts per page. + * + * @param postsPerPage + * The number of posts per page + * @return {@code true} if the number of posts per page was valid, + * {@code false} otherwise + */ + public boolean validatePostsPerPage(Integer postsPerPage) { + return options.getIntegerOption("PostsPerPage").validate(postsPerPage); + } + + /** * Sets the number of posts to show per page. * * @param postsPerPage @@ -2081,6 +2105,18 @@ public class Core implements IdentityListener, UpdateListener { } /** + * Validates the positive trust. + * + * @param positiveTrust + * The positive trust to validate + * @return {@code true} if the positive trust was valid, {@code false} + * otherwise + */ + public boolean validatePositiveTrust(Integer positiveTrust) { + return options.getIntegerOption("PositiveTrust").validate(positiveTrust); + } + + /** * Sets the positive trust. * * @param positiveTrust @@ -2103,6 +2139,18 @@ public class Core implements IdentityListener, UpdateListener { } /** + * Validates the negative trust. + * + * @param negativeTrust + * The negative trust to validate + * @return {@code true} if the negative trust was valid, {@code false} + * otherwise + */ + public boolean validateNegativeTrust(Integer negativeTrust) { + return options.getIntegerOption("NegativeTrust").validate(negativeTrust); + } + + /** * Sets the negative trust. * * @param negativeTrust -- 2.7.4