/** 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); }
protected void doNext() throws IOException { //System.out.println("FE: next upto=" + upto); if (upto == 0) { //System.out.println(" init"); upto = 1; fst.readFirstTargetArc(getArc(0), getArc(1), fstReader); } else { // pop //System.out.println(" check pop curArc target=" + arcs[upto].target + " label=" + arcs[upto].label + " isLast?=" + arcs[upto].isLast()); while (arcs[upto].isLast()) { upto--; if (upto == 0) { //System.out.println(" eof"); return; } } fst.readNextArc(arcs[upto], fstReader); } pushFirst(); }
/** doFloor controls the behavior of advance: if it's true * doFloor is true, advance positions to the biggest * term before target. */ protected FSTEnum(FST<T> fst) { this.fst = fst; fstReader = fst.getBytesReader(); NO_OUTPUT = fst.outputs.getNoOutput(); fst.getFirstArc(getArc(0)); output[0] = NO_OUTPUT; }
private void pushLast() throws IOException { FST.Arc<T> arc = arcs[upto]; assert arc != null; while (true) { setCurrentLabel(arc.label); output[upto] = fst.outputs.add(output[upto-1], arc.output); if (arc.label == FST.END_LABEL) { // Final node break; } incr(); arc = fst.readLastTargetArc(arc, getArc(upto), fstReader); } }
private void pushFirst() throws IOException { FST.Arc<T> arc = arcs[upto]; assert arc != null; while (true) { output[upto] = fst.outputs.add(output[upto-1], arc.output); if (arc.label == FST.END_LABEL) { // Final node break; } //System.out.println(" pushFirst label=" + (char) arc.label + " upto=" + upto + " output=" + fst.outputs.outputToString(output[upto])); setCurrentLabel(arc.label); incr(); final FST.Arc<T> nextArc = getArc(upto); fst.readFirstTargetArc(arc, nextArc, fstReader); arc = nextArc; } }
FST.Arc<T> arc = getArc(upto); int targetLabel = getTargetLabel(); arc = fst.readFirstTargetArc(arc, getArc(upto), fstReader); targetLabel = getTargetLabel(); continue; fst.readFirstTargetArc(getArc(upto-1), arc, fstReader); if (arc.label < targetLabel) { arc = getArc(upto); arc = fst.readFirstTargetArc(arc, getArc(upto), fstReader); targetLabel = getTargetLabel(); } else if (arc.label > targetLabel) { fst.readFirstTargetArc(getArc(upto-1), arc, fstReader); if (arc.label < targetLabel) { arc = getArc(upto);
FST.Arc<T> arc = getArc(upto); int targetLabel = getTargetLabel(); arc = fst.readFirstTargetArc(arc, getArc(upto), fstReader); targetLabel = getTargetLabel(); continue; return; final FST.Arc<T> prevArc = getArc(upto); arc = fst.readFirstTargetArc(arc, getArc(upto), fstReader); targetLabel = getTargetLabel(); } else if (arc.label > targetLabel) { return; final FST.Arc<T> prevArc = getArc(upto);
protected void doNext() throws IOException { //System.out.println("FE: next upto=" + upto); if (upto == 0) { //System.out.println(" init"); upto = 1; fst.readFirstTargetArc(getArc(0), getArc(1), fstReader); } else { // pop //System.out.println(" check pop curArc target=" + arcs[upto].target + " label=" + arcs[upto].label + " isLast?=" + arcs[upto].isLast()); while (arcs[upto].isLast()) { upto--; if (upto == 0) { //System.out.println(" eof"); return; } } fst.readNextArc(arcs[upto], fstReader); } pushFirst(); }
protected void doNext() throws IOException { //System.out.println("FE: next upto=" + upto); if (upto == 0) { //System.out.println(" init"); upto = 1; fst.readFirstTargetArc(getArc(0), getArc(1), fstReader); } else { // pop //System.out.println(" check pop curArc target=" + arcs[upto].target + " label=" + arcs[upto].label + " isLast?=" + arcs[upto].isLast()); while (arcs[upto].isLast()) { upto--; if (upto == 0) { //System.out.println(" eof"); return; } } fst.readNextArc(arcs[upto], fstReader); } pushFirst(); }
protected void doNext() throws IOException { //System.out.println("FE: next upto=" + upto); if (upto == 0) { //System.out.println(" init"); upto = 1; fst.readFirstTargetArc(getArc(0), getArc(1), fstReader); } else { // pop //System.out.println(" check pop curArc target=" + arcs[upto].target + " label=" + arcs[upto].label + " isLast?=" + arcs[upto].isLast()); while (arcs[upto].isLast()) { upto--; if (upto == 0) { //System.out.println(" eof"); return; } } fst.readNextArc(arcs[upto], fstReader); } pushFirst(); }
/** doFloor controls the behavior of advance: if it's true * doFloor is true, advance positions to the biggest * term before target. */ protected FSTEnum(FST<T> fst) { this.fst = fst; fstReader = fst.getBytesReader(); NO_OUTPUT = fst.outputs.getNoOutput(); fst.getFirstArc(getArc(0)); output[0] = NO_OUTPUT; }
/** doFloor controls the behavior of advance: if it's true * doFloor is true, advance positions to the biggest * term before target. */ protected FSTEnum(FST<T> fst) { this.fst = fst; fstReader = fst.getBytesReader(); NO_OUTPUT = fst.outputs.getNoOutput(); fst.getFirstArc(getArc(0)); output[0] = NO_OUTPUT; }
/** doFloor controls the behavior of advance: if it's true * doFloor is true, advance positions to the biggest * term before target. */ protected FSTEnum(FST<T> fst) { this.fst = fst; fstReader = fst.getBytesReader(); NO_OUTPUT = fst.outputs.getNoOutput(); fst.getFirstArc(getArc(0)); output[0] = NO_OUTPUT; }
private void pushLast() throws IOException { FST.Arc<T> arc = arcs[upto]; assert arc != null; while (true) { setCurrentLabel(arc.label); output[upto] = fst.outputs.add(output[upto-1], arc.output); if (arc.label == FST.END_LABEL) { // Final node break; } incr(); arc = fst.readLastTargetArc(arc, getArc(upto), fstReader); } }
private void pushLast() throws IOException { FST.Arc<T> arc = arcs[upto]; assert arc != null; while (true) { setCurrentLabel(arc.label); output[upto] = fst.outputs.add(output[upto-1], arc.output); if (arc.label == FST.END_LABEL) { // Final node break; } incr(); arc = fst.readLastTargetArc(arc, getArc(upto), fstReader); } }
private void pushLast() throws IOException { FST.Arc<T> arc = arcs[upto]; assert arc != null; while (true) { setCurrentLabel(arc.label); output[upto] = fst.outputs.add(output[upto-1], arc.output); if (arc.label == FST.END_LABEL) { // Final node break; } incr(); arc = fst.readLastTargetArc(arc, getArc(upto), fstReader); } }
private void pushFirst() throws IOException { FST.Arc<T> arc = arcs[upto]; assert arc != null; while (true) { output[upto] = fst.outputs.add(output[upto-1], arc.output); if (arc.label == FST.END_LABEL) { // Final node break; } //System.out.println(" pushFirst label=" + (char) arc.label + " upto=" + upto + " output=" + fst.outputs.outputToString(output[upto])); setCurrentLabel(arc.label); incr(); final FST.Arc<T> nextArc = getArc(upto); fst.readFirstTargetArc(arc, nextArc, fstReader); arc = nextArc; } }
private void pushFirst() throws IOException { FST.Arc<T> arc = arcs[upto]; assert arc != null; while (true) { output[upto] = fst.outputs.add(output[upto-1], arc.output); if (arc.label == FST.END_LABEL) { // Final node break; } //System.out.println(" pushFirst label=" + (char) arc.label + " upto=" + upto + " output=" + fst.outputs.outputToString(output[upto])); setCurrentLabel(arc.label); incr(); final FST.Arc<T> nextArc = getArc(upto); fst.readFirstTargetArc(arc, nextArc, fstReader); arc = nextArc; } }
private void pushFirst() throws IOException { FST.Arc<T> arc = arcs[upto]; assert arc != null; while (true) { output[upto] = fst.outputs.add(output[upto-1], arc.output); if (arc.label == FST.END_LABEL) { // Final node break; } //System.out.println(" pushFirst label=" + (char) arc.label + " upto=" + upto + " output=" + fst.outputs.outputToString(output[upto])); setCurrentLabel(arc.label); incr(); final FST.Arc<T> nextArc = getArc(upto); fst.readFirstTargetArc(arc, nextArc, fstReader); arc = nextArc; } }