/** * A generic pattern matching algorithm demonstration program * PatternMatchingAlgorithm.java, Fri July 12 20:xx:yy 1996 * * @author Masayuki Takeda * @version 0.01a, 12 July 1996 */ class PatternMatchingAlgorithm { private PatternMatchingItem parent; protected boolean stopRequested = false; public void setParent(PatternMatchingItem p) { parent = p; } /** * Pause for a while. */ protected void pause(int position, boolean trivial[], int current, boolean mismatch, boolean found, int comparisons) throws Exception { if (stopRequested) { throw new Exception("Pattern Matching Algorithm"); } parent.pause(position, trivial, current, mismatch, found, comparisons); } /** * Stop pattern matching. */ public void stop() { stopRequested = true; } /** * Initialize */ public void init() { stopRequested = false; } /** * This method will be called to * sort an array of integers. */ void find(char t[], int n, char p[], int m) throws Exception { } void clear_table(boolean table[], int m) { for (int i=0; i y) return x; else return y; } int minimum(int x, int y) { if (x < y) return x; else return y; } }