X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fcom%2Fstevesoft%2Fpat%2FBackup.java;h=6602acae77541635ae58a8675753e3a7c571d1f7;hb=83c47970701adc1cd6100332544f7f563e71f8f5;hp=df480ea6a4e38ffd4624d423e573420343fdbf9e;hpb=c40cf903f740a72ab63dd1abc10fa33450ce660d;p=jalview.git diff --git a/src/com/stevesoft/pat/Backup.java b/src/com/stevesoft/pat/Backup.java index df480ea..6602aca 100755 --- a/src/com/stevesoft/pat/Backup.java +++ b/src/com/stevesoft/pat/Backup.java @@ -1,27 +1,54 @@ -// -// 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 the (?<number) Pattern, where number is - an integer telling us how far to back up in the Pattern. - Not in perl 5. It also allows (?>number). */ -class Backup extends Pattern { - int bk; - Backup(int ii) { bk = ii; } - public String toString() { - return "(?" + (bk < 0 ? ">" + (-bk) : "<" + bk) + ")" + nextString(); - } - public int matchInternal(int pos,Pthings pt) { - if(pos < bk) return -1; - return nextMatch(pos-bk,pt); - } - public patInt minChars() { return new patInt(-bk); } - public patInt maxChars() { return new patInt(-bk); } - public Pattern clone1(Hashtable h) { return new Backup(bk); } -}; +// +// 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 the (?<number) Pattern, where number is an integer telling us + * how far to back up in the Pattern. Not in perl 5. It also allows + * (?>number). + */ +class Backup extends Pattern +{ + int bk; + + Backup(int ii) + { + bk = ii; + } + + public String toString() + { + return "(?" + (bk < 0 ? ">" + (-bk) : "<" + bk) + ")" + nextString(); + } + + public int matchInternal(int pos, Pthings pt) + { + if (pos < bk) + { + return -1; + } + return nextMatch(pos - bk, pt); + } + + public patInt minChars() + { + return new patInt(-bk); + } + + public patInt maxChars() + { + return new patInt(-bk); + } + + public Pattern clone1(Hashtable h) + { + return new Backup(bk); + } +};