2 // This software is now distributed according to
\r
3 // the Lesser Gnu Public License. Please see
\r
4 // http://www.gnu.org/copyleft/lesser.txt for
\r
6 // -- Happy Computing!
\r
8 package com.stevesoft.pat;
\r
9 import java.util.Hashtable;
\r
11 /** Implements the parenthesis pattern subelement.*/
\r
12 class OrMark extends Or {
\r
13 SubMark sm = new SubMark();
\r
19 String leftForm() { return "("; }
\r
20 public Pattern getNext() {
\r
23 public int matchInternal(int pos,Pthings pt) {
\r
24 sm.next = super.getNext();
\r
25 if(pt.marks == null) {
\r
26 int n2 = 2 * pt.nMarks+2;
\r
27 pt.marks = new int[n2];
\r
28 for(int i=0;i<n2;i++)
\r
32 int ret = super.matchInternal(pos,pt);
\r
35 else if(pt.marks[id] > pt.marks[id+pt.nMarks]) {
\r
36 int swap = pt.marks[id];
\r
37 pt.marks[id] = pt.marks[id+pt.nMarks]+1;
\r
38 pt.marks[id+pt.nMarks] = swap+1;
\r
42 public Pattern clone1(Hashtable h) {
\r
43 OrMark om = new OrMark(id);
\r
46 for(int i=0;i<v.size();i++)
\r
47 om.v.addElement( ((Pattern)v.elementAt(i)).clone(h) );
\r