X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=unused%2Fcom%2Fstevesoft%2Fpat%2FOrMark.java;h=f73aad502b25244898a793de95ac2870b9f30935;hb=6319110ce33faa76ee6cf9832e78faa224510fed;hp=89b8869790f0439d335ba2a3a30619af15547c7c;hpb=7301a2415adab88038b291fc54caeeb3a5a47a44;p=jalviewjs.git diff --git a/unused/com/stevesoft/pat/OrMark.java b/unused/com/stevesoft/pat/OrMark.java index 89b8869..f73aad5 100644 --- a/unused/com/stevesoft/pat/OrMark.java +++ b/unused/com/stevesoft/pat/OrMark.java @@ -1,73 +1,73 @@ -// -// 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.*; - -/** Implements the parenthesis pattern subelement. */ -class OrMark extends Or -{ - SubMark sm = new SubMark(); - - int id; - - OrMark(int i) - { - sm.om = this; - id = i; - } - - String leftForm() - { - return "("; - } - - public Pattern getNext() - { - return sm; - } - - public int matchInternal(int pos, Pthings pt) - { - sm.next = super.getNext(); - if (pt.marks == null) - { - int n2 = 2 * pt.nMarks + 2; - pt.marks = new int[n2]; - for (int i = 0; i < n2; i++) - { - pt.marks[i] = -1; - } - } - pt.marks[id] = pos; - int ret = super.matchInternal(pos, pt); - if (ret < 0) - { - pt.marks[id] = -1; - } - else if (pt.marks[id] > pt.marks[id + pt.nMarks]) - { - int swap = pt.marks[id]; - pt.marks[id] = pt.marks[id + pt.nMarks] + 1; - pt.marks[id + pt.nMarks] = swap + 1; - } - return ret; - } - - public Pattern clone1(Hashtable h) - { - OrMark om = new OrMark(id); - h.put(om, om); - h.put(this, om); - for (int i = 0; i < v.size(); i++) - { - om.v.addElement(((Pattern) v.elementAt(i)).clone(h)); - } - return om; - } -}; +// +// 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.*; + +/** Implements the parenthesis pattern subelement. */ +class OrMark extends Or +{ + SubMark sm = new SubMark(); + + int id; + + OrMark(int i) + { + sm.om = this; + id = i; + } + + String leftForm() + { + return "("; + } + + public Pattern getNext() + { + return sm; + } + + public int matchInternal(int pos, Pthings pt) + { + sm.next = super.getNext(); + if (pt.marks == null) + { + int n2 = 2 * pt.nMarks + 2; + pt.marks = new int[n2]; + for (int i = 0; i < n2; i++) + { + pt.marks[i] = -1; + } + } + pt.marks[id] = pos; + int ret = super.matchInternal(pos, pt); + if (ret < 0) + { + pt.marks[id] = -1; + } + else if (pt.marks[id] > pt.marks[id + pt.nMarks]) + { + int swap = pt.marks[id]; + pt.marks[id] = pt.marks[id + pt.nMarks] + 1; + pt.marks[id + pt.nMarks] = swap + 1; + } + return ret; + } + + public Pattern clone1(Hashtable h) + { + OrMark om = new OrMark(id); + h.put(om, om); + h.put(this, om); + for (int i = 0; i < v.size(); i++) + { + om.v.addElement(((Pattern) v.elementAt(i)).clone(h)); + } + return om; + } +};