X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fcom%2Fstevesoft%2Fpat%2FBackup.java;h=6602acae77541635ae58a8675753e3a7c571d1f7;hb=4b2be7cd8c14e67cc347609199e25c7f09fda988;hp=31c41c4991b79b26e7d5895a9979c168363ef738;hpb=7bc226b58110fa26d9dbd3f0c78095d06909ffc3;p=jalview.git diff --git a/src/com/stevesoft/pat/Backup.java b/src/com/stevesoft/pat/Backup.java index 31c41c4..6602aca 100755 --- a/src/com/stevesoft/pat/Backup.java +++ b/src/com/stevesoft/pat/Backup.java @@ -1,52 +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.*; - -/** 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); + } +};