public void next(BFeatureImpl f) {
    if (directSegmentMode) {
      super.next(f);
      return;
    }

    assignBoundary(bfeatureImpl, currPos);
    f.copy(bfeatureImpl);
    advance();
  }
  public void next(BFeatureImpl f) {
    if (directSegmentMode) {
      super.next(f);
      return;
    }
    f.copy(fImpl);
    //        assignBoundaryInt(f,pos);
    String name = "";
    if (featureCollectMode()) {
      name += f.strId.name + ".W." + windows[currentWindow];
    }
    setFeatureIdentifier(f.strId.id * windows.length + currentWindow, f.strId.stateId, name, f);

    assert (!windows[currentWindow].toString().equals("unique")
        || (!f._startOpen && !f._endOpen && (f._startB == f._endB)));
    assert (!windows[currentWindow].toString().equals("end")
        || (f._startOpen && !f._endOpen && (f._startB + 1 == f._endB)));
    // next((FeatureImpl)f);
    //	    f.copyBoundary(boundary);
    //	    assert((boundary._startB >= 0) && (boundary._endB < dataSeq.length()));
    advance();
  }
 private void initFeatureOpenFlag(Window twindow, BFeatureImpl tfeatureImpl) {
   switch (getWindowType(twindow)) {
     case WIN_LEFT:
       tfeatureImpl._startOpen = false;
       tfeatureImpl._endOpen = (twindow.maxLength == Integer.MAX_VALUE);
       break;
     case WIN_RIGHT:
       tfeatureImpl._startOpen = (twindow.maxLength == Integer.MAX_VALUE);
       tfeatureImpl._endOpen = false;
       break;
     case WIN_MIDDLE:
       tfeatureImpl._startOpen = twindow.maxLength == Integer.MAX_VALUE;
       tfeatureImpl._endOpen = twindow.maxLength == Integer.MAX_VALUE;
       break;
     default:
       assert (false);
   }
 }
 private boolean nextFeatureNew() {
   Window twindow = windows[currWin];
   currBdry++;
   if (currBdry <= cfRange.end) {
     switch (getWindowType(twindow)) {
       case WIN_LEFT:
         fboundary._startB = currBdry;
         fboundary._endB = fboundary._startB + minWinLength - 1;
         break;
       case WIN_RIGHT:
         fboundary._endB = currBdry;
         fboundary._startB = fboundary._endB - minWinLength + 1;
         break;
       case WIN_MIDDLE:
         fboundary._startB = currBdry;
         fboundary._endB = fboundary._startB + maxGap - 1;
         break;
     }
     return true;
   } else {
     featureValid = false;
     return false;
   }
 }
 /* (non-Javadoc)
  * @see iitb.Model.FeatureTypes#startScanFeaturesAt(iitb.CRF.DataSequence, int)
  * all windows that overlap with this position
  *
  */
 private void assignBoundaryInt(BFeatureImpl feature, int pos) {
   Window w = windows[currentWindow];
   if (w.startRelativeToLeft && w.endRelativeToLeft) {
     // TODO -- handle this case. for each value between w.start..w.end generate a different
     // feature
     assert (pos - w.start == pos - w.end);
     feature._startB = pos - w.start;
     feature._endB = feature._startB + w.minLength - 1;
     feature._startOpen = false;
     feature._endOpen = (w.maxLength == Integer.MAX_VALUE);
   } else if (w.startRelativeToLeft && !w.endRelativeToLeft) {
     feature._startB = pos - w.start;
     feature._endB = pos - w.end;
     feature._startOpen = (w.maxLength == Integer.MAX_VALUE);
     feature._endOpen = (w.maxLength == Integer.MAX_VALUE);
   } else if (!w.startRelativeToLeft && !w.endRelativeToLeft) {
     assert (pos - w.start == pos - w.end);
     feature._endB = pos - w.end;
     feature._startB = feature._endB - w.minLength + 1;
     feature._startOpen = (w.maxLength == Integer.MAX_VALUE);
     feature._endOpen = false;
   } else assert (false); // invalid combination
 }
 public void assignBoundary(BFeatureImpl tfeatureImpl, int tpos) {
   tfeatureImpl.copyBoundary(fboundary);
 }