/** Rewinds enum state to match the shared prefix between * current term and target term */ protected final void rewindPrefix() throws IOException { if (upto == 0) { //System.out.println(" init"); upto = 1; fst.readFirstTargetArc(getArc(0), getArc(1), fstReader); return; } //System.out.println(" rewind upto=" + upto + " vs targetLength=" + targetLength); final int currentLimit = upto; upto = 1; while (upto < currentLimit && upto <= targetLength+1) { final int cmp = getCurrentLabel() - getTargetLabel(); if (cmp < 0) { // seek forward //System.out.println(" seek fwd"); break; } else if (cmp > 0) { // seek backwards -- reset this arc to the first arc final FST.Arc<T> arc = getArc(upto); fst.readFirstTargetArc(getArc(upto-1), arc, fstReader); //System.out.println(" seek first arc"); break; } upto++; } //System.out.println(" fall through upto=" + upto); }
/** Rewinds enum state to match the shared prefix between * current term and target term */ protected final void rewindPrefix() throws IOException { if (upto == 0) { //System.out.println(" init"); upto = 1; fst.readFirstTargetArc(getArc(0), getArc(1), fstReader); return; } //System.out.println(" rewind upto=" + upto + " vs targetLength=" + targetLength); final int currentLimit = upto; upto = 1; while (upto < currentLimit && upto <= targetLength+1) { final int cmp = getCurrentLabel() - getTargetLabel(); if (cmp < 0) { // seek forward //System.out.println(" seek fwd"); break; } else if (cmp > 0) { // seek backwards -- reset this arc to the first arc final FST.Arc<T> arc = getArc(upto); fst.readFirstTargetArc(getArc(upto-1), arc, fstReader); //System.out.println(" seek first arc"); break; } upto++; } //System.out.println(" fall through upto=" + upto); }
/** Rewinds enum state to match the shared prefix between * current term and target term */ protected final void rewindPrefix() throws IOException { if (upto == 0) { //System.out.println(" init"); upto = 1; fst.readFirstTargetArc(getArc(0), getArc(1), fstReader); return; } //System.out.println(" rewind upto=" + upto + " vs targetLength=" + targetLength); final int currentLimit = upto; upto = 1; while (upto < currentLimit && upto <= targetLength+1) { final int cmp = getCurrentLabel() - getTargetLabel(); if (cmp < 0) { // seek forward //System.out.println(" seek fwd"); break; } else if (cmp > 0) { // seek backwards -- reset this arc to the first arc final FST.Arc<T> arc = getArc(upto); fst.readFirstTargetArc(getArc(upto-1), arc, fstReader); //System.out.println(" seek first arc"); break; } upto++; } //System.out.println(" fall through upto=" + upto); }
/** Rewinds enum state to match the shared prefix between * current term and target term */ protected final void rewindPrefix() throws IOException { if (upto == 0) { //System.out.println(" init"); upto = 1; fst.readFirstTargetArc(getArc(0), getArc(1), fstReader); return; } //System.out.println(" rewind upto=" + upto + " vs targetLength=" + targetLength); final int currentLimit = upto; upto = 1; while (upto < currentLimit && upto <= targetLength+1) { final int cmp = getCurrentLabel() - getTargetLabel(); if (cmp < 0) { // seek forward //System.out.println(" seek fwd"); break; } else if (cmp > 0) { // seek backwards -- reset this arc to the first arc final FST.Arc<T> arc = getArc(upto); fst.readFirstTargetArc(getArc(upto-1), arc, fstReader); //System.out.println(" seek first arc"); break; } upto++; } //System.out.println(" fall through upto=" + upto); }