-//\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
-import java.util.Hashtable;\r
-\r
-/** Implements "(?= )" and "(?! )" */\r
-class lookAhead extends Or {\r
- boolean reverse;\r
- lookAhead(boolean b) { reverse = b; }\r
- public Pattern getNext() { return null; }\r
- public int nextMatch(int pos,Pthings pt) {\r
- Pattern p = super.getNext();\r
- if(p != null) return p.matchInternal(pos,pt);\r
- else return pos;\r
- }\r
- public int matchInternal(int pos,Pthings pt) {\r
- if(super.matchInternal(pos,pt) >= 0) {\r
- if(reverse) return -1;\r
- else return nextMatch(pos,pt);\r
- } else {\r
- if(reverse) return nextMatch(pos,pt);\r
- else return -1;\r
- }\r
- }\r
- String leftForm() {\r
- if(reverse)\r
- return "(?!";\r
- else\r
- return "(?=";\r
- }\r
- public patInt minChars() { return new patInt(0); }\r
- public patInt maxChars() { return new patInt(0); }\r
- Pattern clone1(Hashtable h) {\r
- lookAhead la=new lookAhead(reverse);\r
- h.put(this,la);\r
- h.put(la,la);\r
- for(int i=0;i<v.size();i++)\r
- la.v.addElement( ((Pattern)v.elementAt(i)).clone(h) );\r
- return la;\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;
+
+import java.util.Hashtable;
+
+/** Implements "(?= )" and "(?! )" */
+class lookAhead extends Or
+{
+ boolean reverse;
+
+ lookAhead(boolean b)
+ {
+ reverse = b;
+ }
+
+ public Pattern getNext()
+ {
+ return null;
+ }
+
+ public int nextMatch(int pos, Pthings pt)
+ {
+ Pattern p = super.getNext();
+ if (p != null)
+ {
+ return p.matchInternal(pos, pt);
+ }
+ else
+ {
+ return pos;
+ }
+ }
+
+ public int matchInternal(int pos, Pthings pt)
+ {
+ if (super.matchInternal(pos, pt) >= 0)
+ {
+ if (reverse)
+ {
+ return -1;
+ }
+ else
+ {
+ return nextMatch(pos, pt);
+ }
+ }
+ else
+ {
+ if (reverse)
+ {
+ return nextMatch(pos, pt);
+ }
+ else
+ {
+ return -1;
+ }
+ }
+ }
+
+ String leftForm()
+ {
+ if (reverse)
+ {
+ return "(?!";
+ }
+ else
+ {
+ return "(?=";
+ }
+ }
+
+ public patInt minChars()
+ {
+ return new patInt(0);
+ }
+
+ public patInt maxChars()
+ {
+ return new patInt(0);
+ }
+
+ Pattern clone1(Hashtable h)
+ {
+ lookAhead la = new lookAhead(reverse);
+ h.put(this, la);
+ h.put(la, la);
+ for (int i = 0; i < v.size(); i++)
+ {
+ la.v.addElement(((Pattern) v.elementAt(i)).clone(h));
+ }
+ return la;
+ }
+}