Package com.algo.parser
Class DoubleSyntaxChecker
- java.lang.Object
-
- com.algo.parser.SyntaxChecker
-
- com.algo.parser.DoubleSyntaxChecker
-
public class DoubleSyntaxChecker extends SyntaxChecker
Accepts doubles, 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 DoubleSyntaxChecker()
Constructs a syntax checker which accepts all strings representing an integer.DoubleSyntaxChecker(double lowerBound, double upperBound)
Constructs a syntax checker which accepts all strings representing a double 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
-
DoubleSyntaxChecker
public DoubleSyntaxChecker()
Constructs a syntax checker which accepts all strings representing an integer. Rejects strings representing integers that would cause an overflow for the int datatype.
-
DoubleSyntaxChecker
public DoubleSyntaxChecker(double lowerBound, double upperBound)
Constructs a syntax checker which accepts all strings representing a double 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.
-
-