/** * Also {@link #reset() resets} this controller for safety, because changing the repeat type part way through an * interpolation can cause problems. * * @param repeatType * The new repeat type to use. */ @Override public void setRepeatType(final RepeatType repeatType) { if (getRepeatType() != repeatType) { /* Reset for safety */ reset(); } super.setRepeatType(repeatType); }
/** * Also {@link #reset() resets} this controller for safety, because changing the repeat type part way through an * interpolation can cause problems. * * @param repeatType * The new repeat type to use. */ @Override public void setRepeatType(final RepeatType repeatType) { if (getRepeatType() != repeatType) { /* Reset for safety */ reset(); } super.setRepeatType(repeatType); }
/** * This method assumes the {@link #getIndex() index} has already been {@link #clampIndex() clamped} correctly. * * @return The control to interpolate from, will not be <code>null</code>. * @see #getControlTo() */ protected C getControlFrom() { C from = null; switch (getRepeatType()) { case CLAMP: if (getIndex() > getMaximumIndex()) { from = getControls().get(getMaximumIndex()); } else { from = getControls().get(getIndex()); } break; case CYCLE: from = getControls().get(getIndex()); break; case WRAP: from = getControls().get(getIndex()); break; } return from; }
/** * This method assumes the {@link #getIndex() index} has already been {@link #clampIndex() clamped} correctly. * * @return The control to interpolate from, will not be <code>null</code>. * @see #getControlTo() */ protected C getControlFrom() { C from = null; switch (getRepeatType()) { case CLAMP: if (getIndex() > getMaximumIndex()) { from = getControls().get(getMaximumIndex()); } else { from = getControls().get(getIndex()); } break; case CYCLE: from = getControls().get(getIndex()); break; case WRAP: from = getControls().get(getIndex()); break; } return from; }
/** * This method assumes the {@link #getIndex() index} has already been {@link #clampIndex() clamped} correctly. * * @return The control to interpolate to, will not be <code>null</code>. * @see #getControlFrom() */ protected C getControlTo() { C to = null; switch (getRepeatType()) { case CLAMP: if (getIndex() >= getMaximumIndex()) { to = getControls().get(getMaximumIndex()); } else { to = getControls().get(getIndex() + 1); } break; case CYCLE: if (isCycleForward()) { to = getControls().get(getIndex() + 1); } else { to = getControls().get(getIndex() - 1); } break; case WRAP: to = getControls().get(getIndex() + 1); break; } return to; }
/** * This method assumes the {@link #getIndex() index} has already been {@link #clampIndex() clamped} correctly. * * @return The control to interpolate to, will not be <code>null</code>. * @see #getControlFrom() */ protected C getControlTo() { C to = null; switch (getRepeatType()) { case CLAMP: if (getIndex() >= getMaximumIndex()) { to = getControls().get(getMaximumIndex()); } else { to = getControls().get(getIndex() + 1); } break; case CYCLE: if (isCycleForward()) { to = getControls().get(getIndex() + 1); } else { to = getControls().get(getIndex() - 1); } break; case WRAP: to = getControls().get(getIndex() + 1); break; } return to; }
switch (getRepeatType()) { case CLAMP: if (getIndex() >= getMaximumIndex()) {
switch (getRepeatType()) { case CLAMP: if (getIndex() >= getMaximumIndex()) {