diff options
| author | bjculkin <bjculkin@mix.wvu.edu> | 2017-03-17 08:33:37 -0400 |
|---|---|---|
| committer | bjculkin <bjculkin@mix.wvu.edu> | 2017-03-17 08:33:37 -0400 |
| commit | a63c30f5fe9ee302e73bb30e35095d789adb1a80 (patch) | |
| tree | 8bb952e6c4f61172597e945f58d8244c24ea88b0 /BJC-Utils2/src/main/java/bjc/utils/funcutils/DoubleMatcher.java | |
| parent | 897c15c70a6b11463686293893518bd9b4d5c29c (diff) | |
Refactor StringUtils
Moved a bunch of token-oriented stuff from StringUtils to a new TokenUtils
class.
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/funcutils/DoubleMatcher.java')
| -rw-r--r-- | BJC-Utils2/src/main/java/bjc/utils/funcutils/DoubleMatcher.java | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/BJC-Utils2/src/main/java/bjc/utils/funcutils/DoubleMatcher.java b/BJC-Utils2/src/main/java/bjc/utils/funcutils/DoubleMatcher.java deleted file mode 100644 index 03227ed..0000000 --- a/BJC-Utils2/src/main/java/bjc/utils/funcutils/DoubleMatcher.java +++ /dev/null @@ -1,71 +0,0 @@ -package bjc.utils.funcutils; - -import java.util.regex.Pattern; - -/* - * Checks if a string would pass Double.parseDouble. - * - * Uses a regex from the javadoc for Double.valueOf() - */ -class DoubleMatcher { - private static final String Digits = "(\\p{Digit}+)"; - private static final String HexDigits = "(\\p{XDigit}+)"; - - /* - * an exponent is 'e' or 'E' followed by an optionally signed decimal - * integer. - */ - private static final String Exp = "[eE][+-]?" + Digits; - - private static final String fpRegex = - "[\\x00-\\x20]*" // Optional leading "whitespace" - + "[+-]?(" + // Optional sign character - "NaN|" + // "NaN" string - "Infinity|" + // "Infinity" string - - /* - * A decimal floating-point string representing a finite - * positive number without a leading sign has at most - * five basic pieces: Digits . Digits ExponentPart - * FloatTypeSuffix - * - * Since this method allows integer-only strings as - * input in addition to strings of floating-point - * literals, the two sub-patterns below are - * simplifications of the grammar productions from - * section 3.10.2 of The Java™ Language Specification. - */ - - /* - * Digits ._opt Digits_opt ExponentPart_opt - * FloatTypeSuffix_opt - */ - "(((" + Digits + "(\\.)?(" + Digits + "?)(" + Exp + ")?)|" + - - /* - * . Digits ExponentPart_opt FloatTypeSuffix_opt - */ - "(\\.(" + Digits + ")(" + Exp + ")?)|" + - - /* - * Hexadecimal strings - */ - "((" + - /* - * 0[xX] HexDigits ._opt BinaryExponent - * FloatTypeSuffix_opt - */ - "(0[xX]" + HexDigits + "(\\.)?)|" + - - /* - * 0[xX] HexDigits_opt . HexDigits BinaryExponent - * FloatTypeSuffix_opt - */ - "(0[xX]" + HexDigits + "?(\\.)" + HexDigits + ")" + - - ")[pP][+-]?" + Digits + "))" + "[fFdD]?))" + "[\\x00-\\x20]*"; // Optional - // trailing - // "whitespace" - - public static final Pattern floatingLiteral = Pattern.compile("\\A" + fpRegex + "\\Z"); -} |
