Package com.algo.parser
Class IntSyntaxChecker
- java.lang.Object
-
- com.algo.parser.SyntaxChecker
-
- com.algo.parser.IntSyntaxChecker
-
public class IntSyntaxChecker extends SyntaxChecker
Accepts integers, possibly restricted to a given range.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.algo.parser.SyntaxChecker
SyntaxChecker.Parser<T>, SyntaxChecker.Result
-
-
Constructor Summary
Constructors Constructor Description IntSyntaxChecker()
Constructs a syntax checker which accepts all strings representing an integer.IntSyntaxChecker(int lowerBound, int upperBound)
Constructs a syntax checker which accepts all strings representing an integer in the range [lowerBound, upperBound].
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SyntaxChecker.Result
check(java.lang.String input)
Performs a syntax check on the given string.
-
-
-
Constructor Detail
-
IntSyntaxChecker
public IntSyntaxChecker()
Constructs a syntax checker which accepts all strings representing an integer. Rejects strings representing integers that would cause an overflow for the int datatype.
-
IntSyntaxChecker
public IntSyntaxChecker(int lowerBound, int upperBound)
Constructs a syntax checker which accepts all strings representing an integer in the range [lowerBound, upperBound].- Parameters:
lowerBound
- The smallest acceptable value.upperBound
- The largest acceptable value.
-
-
Method Detail
-
check
public SyntaxChecker.Result check(java.lang.String input)
Description copied from class:SyntaxChecker
Performs a syntax check on the given string.- Specified by:
check
in classSyntaxChecker
- Parameters:
input
- The string to check.- Returns:
- The result of syntax checking the given string.
-
-