X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fcom%2Fstevesoft%2Fpat%2FCustom.java;h=3251fa3e06046131edba2b4e713fda8786acd54c;hb=90cdc6b3f35ec9f98121a0e9c74e9ca4f7923cd3;hp=e7621a1774be323c3dc4b569820d7298ac1701ac;hpb=c40cf903f740a72ab63dd1abc10fa33450ce660d;p=jalview.git diff --git a/src/com/stevesoft/pat/Custom.java b/src/com/stevesoft/pat/Custom.java index e7621a1..3251fa3 100755 --- a/src/com/stevesoft/pat/Custom.java +++ b/src/com/stevesoft/pat/Custom.java @@ -1,42 +1,64 @@ -// -// 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; - -/** Simple custom patterns. See - deriv2.java - and deriv3.java - in the test directory. - @see com.stevesoft.pat.CustomEndpoint - */ -class Custom extends PatternSub { - String select; - Validator v; - int start; - Custom(String s) { - select = s; - v = (Validator)Regex.validators.get(s); - } - public int matchInternal(int pos,Pthings pt) { - start = pos; - return sub.matchInternal(pos,pt); - } - public String toString() { - String a = v.argsave == null ? "" : ":"+v.argsave; - return "(??"+select+a+")"+nextString(); - } - public patInt minChars() { return v.minChars(); } - public patInt maxChars() { return v.maxChars(); } - Pattern clone1(Hashtable h) { - Custom c = new Custom(select); - h.put(c,c); - h.put(this,c); - c.sub = sub.clone(h); - return c; - } -} +// +// 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; + +/** + * Simple custom patterns. See deriv2.java and deriv3.java in the test + * directory. + * + * @see com.stevesoft.pat.CustomEndpoint + */ +class Custom extends PatternSub +{ + String select; + + Validator v; + + int start; + + Custom(String s) + { + select = s; + v = (Validator) Regex.validators.get(s); + } + + public int matchInternal(int pos, Pthings pt) + { + start = pos; + return sub.matchInternal(pos, pt); + } + + public String toString() + { + String a = v.argsave == null ? "" : ":" + v.argsave; + return "(??" + select + a + ")" + nextString(); + } + + public patInt minChars() + { + return v.minChars(); + } + + public patInt maxChars() + { + return v.maxChars(); + } + + Pattern clone1(Hashtable h) + { + Custom c = new Custom(select); + h.put(c, c); + h.put(this, c); + c.sub = sub.clone(h); + return c; + } +}