Author: michiel Date: 2010-02-15 23:33:11 +0100 (Mon, 15 Feb 2010) New Revision: 41039
Modified: mmbase/trunk/core/src/main/java/org/mmbase/datatypes/StringDataType.java Log: moved some patterns to utils/Casting Modified: mmbase/trunk/core/src/main/java/org/mmbase/datatypes/StringDataType.java =================================================================== --- mmbase/trunk/core/src/main/java/org/mmbase/datatypes/StringDataType.java 2010-02-15 22:32:25 UTC (rev 41038) +++ mmbase/trunk/core/src/main/java/org/mmbase/datatypes/StringDataType.java 2010-02-15 22:33:11 UTC (rev 41039) @@ -57,51 +57,8 @@ } } - public static final Pattern DOUBLE_PATTERN; - static { - // copied from javadoc of Double: http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Double.html#valueOf(java.lang.String) - final String Digits = "(\\p{Digit}+)"; - final String HexDigits = "(\\p{XDigit}+)"; - // an exponent is 'e' or 'E' followed by an optionally - // signed decimal integer. - final String Exp = "[eE][+-]?"+Digits; - 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 the Java Language Specification, 2nd - // edition, section 3.10.2. - - // 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" - - DOUBLE_PATTERN = Pattern.compile(fpRegex); - } - public static final Pattern BOOLEAN_PATTERN = Pattern.compile("\\A(1|0|true|false)\\z"); + public static final Pattern DOUBLE_PATTERN = Casting.DOUBLE_PATTERN; + public static final Pattern BOOLEAN_PATTERN = Casting.BOOLEAN_PATTERN; public static final Pattern INTEGER_PATTERN = Pattern.compile("\\A-?[0-9]+\\z"); public static final Pattern NON_NEGATIVE_INTEGER_PATTERN = Pattern.compile("\\A[0-9]+\\z"); public static final Pattern LONG_PATTERN = INTEGER_PATTERN; _______________________________________________ Cvs mailing list Cvs@lists.mmbase.org http://lists.mmbase.org/mailman/listinfo/cvs