protected void updateCurrentKeyFrameForTime(float time) {
    // Assertion: times are sorted in monotone order.
    // Assertion: keyFrame_ is not empty

    // TODO: Special case for loops when closed path is implemented !!
    if (!currentFrmValid)
      // Recompute everything from scratch
      currentFrame1 = keyFrameList.listIterator();

    // currentFrame_[1]->peekNext() <---> keyFr.get(currentFrame1.nextIndex());
    while (keyFrameList.get(currentFrame1.nextIndex()).time() > time) {
      currentFrmValid = false;
      if (!currentFrame1.hasPrevious()) break;
      currentFrame1.previous();
    }

    if (!currentFrmValid) currentFrame2 = keyFrameList.listIterator(currentFrame1.nextIndex());

    while (keyFrameList.get(currentFrame2.nextIndex()).time() < time) {
      currentFrmValid = false;

      if (!currentFrame2.hasNext()) break;

      currentFrame2.next();
    }

    if (!currentFrmValid) {
      currentFrame1 = keyFrameList.listIterator(currentFrame2.nextIndex());

      if ((currentFrame1.hasPrevious())
          && (time < keyFrameList.get(currentFrame2.nextIndex()).time())) currentFrame1.previous();

      currentFrame0 = keyFrameList.listIterator(currentFrame1.nextIndex());

      if (currentFrame0.hasPrevious()) currentFrame0.previous();

      currentFrame3 = keyFrameList.listIterator(currentFrame2.nextIndex());

      if (currentFrame3.hasNext()) currentFrame3.next();

      currentFrmValid = true;
      splineCacheIsValid = false;
    }
  }
  protected KeyFrameInterpolator(KeyFrameInterpolator otherKFI) {
    this.gScene = otherKFI.gScene;
    this.path = new ArrayList<Frame>();
    ListIterator<Frame> frameIt = otherKFI.path.listIterator();
    while (frameIt.hasNext()) {
      this.path.add(frameIt.next().get());
    }

    this.setFrame(otherKFI.frame());

    this.period = otherKFI.period;
    this.interpolationTm = otherKFI.interpolationTm;
    this.interpolationSpd = otherKFI.interpolationSpd;
    this.interpolationStrt = otherKFI.interpolationStrt;
    this.lpInterpolation = otherKFI.lpInterpolation;
    this.pathIsValid = otherKFI.pathIsValid;
    this.valuesAreValid = otherKFI.valuesAreValid;
    this.currentFrmValid = otherKFI.currentFrmValid;

    this.keyFrameList = new ArrayList<KeyFrame>();

    for (KeyFrame element : otherKFI.keyFrameList) {
      KeyFrame kf = (KeyFrame) element.get();
      this.keyFrameList.add(kf);
    }

    this.currentFrame0 = keyFrameList.listIterator(otherKFI.currentFrame0.nextIndex());
    this.currentFrame1 = keyFrameList.listIterator(otherKFI.currentFrame1.nextIndex());
    this.currentFrame2 = keyFrameList.listIterator(otherKFI.currentFrame2.nextIndex());
    this.currentFrame3 = keyFrameList.listIterator(otherKFI.currentFrame3.nextIndex());

    this.interpolationTimerTask =
        new TimingTask() {
          public void execute() {
            update();
          }
        };
    gScene.registerTimingTask(interpolationTimerTask);

    this.invalidateValues();
  }