-//\r
-// This software is now distributed according to\r
-// the Lesser Gnu Public License. Please see\r
-// http://www.gnu.org/copyleft/lesser.txt for\r
-// the details.\r
-// -- Happy Computing!\r
-//\r
-package com.stevesoft.pat;\r
-\r
-/** This class makes it easy to create your own patterns\r
- and integrate them into Regex. For more detail, see the\r
- example file <a href="http://javaregex.com/code/deriv2.java.html">deriv2.java</a> or\r
- <a href="http://javaregex.com/code/deriv3.java.html">deriv3.java</a>. */\r
-\r
-public class Validator\r
-{\r
- String argsave = null;\r
- String pattern = ".";\r
- /**\r
- This method does extra checking on a matched section of\r
- a String beginning at position start and ending at end.\r
- The idea is that you can do extra checking with this\r
- that you don't know how to do with a standard Regex.\r
-\r
- If this method is successful, it returns the location\r
- of the end of this pattern element -- that may be the\r
- value end provided or some other value. A negative\r
- value signifies that a match failure.\r
-\r
- By default, this method just returns end and thus\r
- does nothing.\r
- @see com.stevesoft.pat.Regex#define(java.lang.String,java.lang.String,com.stevesoft.pat.Validator)\r
- */\r
- public int validate(StringLike src, int start, int end)\r
- {\r
- return end;\r
- }\r
-\r
- /* This method allows you to modify the behavior of this\r
- validator by making a new Validator object. If a Validator\r
- named "foo" is defined, then the pattern "{??foo:bar}" will\r
- cause Regex to first get the Validator given to Regex.define\r
- and then to call its arg method with the string "bar".\r
- If this method returns a null (the default) you get the same\r
- behavior as the pattern "{??foo}" would supply. */\r
- public Validator arg(String s)\r
- {\r
- return null;\r
- }\r
-\r
- /** For optimization it is helpful, but not necessary, that\r
- you define the minimum number of characters this validator\r
- will allow to match. To do this\r
- return new patInt(number) where number is the smallest\r
- number of characters that can match. */\r
- public patInt minChars()\r
- {\r
- return new patInt(0);\r
- }\r
-\r
- /** For optimization it is helpful, but not necessary, that\r
- you define the maximum number of characters this validator\r
- will allow to match. To do this either\r
- return new patInt(number), or new patInf() if an infinite\r
- number of characters may match. */\r
- public patInt maxChars()\r
- {\r
- return new patInf();\r
- }\r
-}\r
+//
+// This software is now distributed according to
+// the Lesser Gnu Public License. Please see
+// http://www.gnu.org/copyleft/lesser.txt for
+// the details.
+// -- Happy Computing!
+//
+package com.stevesoft.pat;
+
+/**
+ * This class makes it easy to create your own patterns and integrate them into
+ * Regex. For more detail, see the example file
+ * <a href="http://javaregex.com/code/deriv2.java.html">deriv2.java</a> or
+ * <a href="http://javaregex.com/code/deriv3.java.html">deriv3.java</a>.
+ */
+
+public class Validator
+{
+ String argsave = null;
+
+ String pattern = ".";
+
+ /**
+ * This method does extra checking on a matched section of a String beginning
+ * at position start and ending at end. The idea is that you can do extra
+ * checking with this that you don't know how to do with a standard Regex.
+ *
+ * If this method is successful, it returns the location of the end of this
+ * pattern element -- that may be the value end provided or some other value.
+ * A negative value signifies that a match failure.
+ *
+ * By default, this method just returns end and thus does nothing.
+ *
+ * @see com.stevesoft.pat.Regex#define(java.lang.String,java.lang.String,com.stevesoft.pat.Validator)
+ */
+ public int validate(StringLike src, int start, int end)
+ {
+ return end;
+ }
+
+ /*
+ * This method allows you to modify the behavior of this validator by making a
+ * new Validator object. If a Validator named "foo" is defined, then the
+ * pattern "{??foo:bar}" will cause Regex to first get the Validator given to
+ * Regex.define and then to call its arg method with the string "bar". If this
+ * method returns a null (the default) you get the same behavior as the
+ * pattern "{??foo}" would supply.
+ */
+ public Validator arg(String s)
+ {
+ return null;
+ }
+
+ /**
+ * For optimization it is helpful, but not necessary, that you define the
+ * minimum number of characters this validator will allow to match. To do this
+ * return new patInt(number) where number is the smallest number of characters
+ * that can match.
+ */
+ public patInt minChars()
+ {
+ return new patInt(0);
+ }
+
+ /**
+ * For optimization it is helpful, but not necessary, that you define the
+ * maximum number of characters this validator will allow to match. To do this
+ * either return new patInt(number), or new patInf() if an infinite number of
+ * characters may match.
+ */
+ public patInt maxChars()
+ {
+ return new patInf();
+ }
+}