// Path: projects/main/src/main/java/libshapedraw/animation/trident/ease/TimelineEase.java
// public interface TimelineEase {
// 	public float map(float durationFraction);
// }


import libshapedraw.animation.trident.ease.TimelineEase;

// original package: org.pushingpixels.trident.interpolator
// imported from http://kenai.com/projects/trident/ (version 1.3)
/**
 * Copyright (c) 2006, Sun Microsystems, Inc
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 
 *   * Redistributions of source code must retain the above copyright
 *     notice, this list of conditions and the following disclaimer.
 *   * Redistributions in binary form must reproduce the above
 *     copyright notice, this list of conditions and the following 
 *     disclaimer in the documentation and/or other materials provided 
 *     with the distribution.
 *   * Neither the name of the TimingFramework project nor the names of its
 *     contributors may be used to endorse or promote products derived 
 *     from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package libshapedraw.animation.trident.interpolator;


/**
 * 
 * KeyFrames holds information about the times at which values are sampled
 * (KeyTimes) and the values at those times (KeyValues). It also holds
 * information about how to interpolate between these values for times that lie
 * between the sampling points.
 * 
 * @author Chet
 */
public class KeyFrames<T> {

    private KeyValues<T> keyValues;
    private KeyTimes keyTimes;
    private KeyInterpolators interpolators;

    /**
     * Simplest variation; determine keyTimes based on even division of 0-1
     * range based on number of keyValues. This constructor assumes LINEAR
     * interpolation.
     * 
     * @param keyValues
     *            values that will be assumed at each time in keyTimes
     */
    public KeyFrames(KeyValues<T> keyValues) {
        init(keyValues, null, (TimelineEase) null);
    }

    /**
     * This variant takes both keyValues (values at each point in time) and
     * keyTimes (times at which values are sampled).
     * 
     * @param keyValues
     *            values that the animation will assume at each of the
     *            corresponding times in keyTimes
     * @param keyTimes
     *            times at which the animation will assume the corresponding
     *            values in keyValues
     * @throws IllegalArgumentException
     *             keyTimes and keySizes must have the same number of elements
     *             since these structures are meant to have corresponding
     *             entries; an exception is thrown otherwise.
     */
    public KeyFrames(KeyValues<T> keyValues, KeyTimes keyTimes) {
        init(keyValues, keyTimes, (TimelineEase) null);
    }

    /**
     * Full constructor: caller provides an instance of all key* structures
     * which will be used to calculate between all times in the keyTimes list. A
     * null interpolator parameter is equivalent to calling
     * {@link KeyFrames#KeyFrames(KeyValues, KeyTimes)}.
     * 
     * @param keyValues
     *            values that the animation will assume at each of the
     *            corresponding times in keyTimes
     * @param keyTimes
     *            times at which the animation will assume the corresponding
     *            values in keyValues
     * @param interpolators
     *            collection of Interpolators that control the calculation of
     *            values in each of the intervals defined by keyFrames. If this
     *            value is null, a linear interpolator will be used for
     *            all intervals. If there is only one interpolator, that
     *            interpolator will be used for all intervals. Otherwise, there
     *            must be a number of interpolators equal to the number of
     *            intervals (which is one less than the number of keyTimes).
     * @throws IllegalArgumentException
     *             keyTimes and keyValues must have the same number of elements
     *             since these structures are meant to have corresponding
     *             entries; an exception is thrown otherwise.
     * @throws IllegalArgumentException
     *             The number of interpolators must either be zero
     *             (interpolators == null), one, or one less than the size of
     *             keyTimes.
     */
    public KeyFrames(KeyValues<T> keyValues, KeyTimes keyTimes,
            TimelineEase... interpolators) {
        init(keyValues, keyTimes, interpolators);
    }

    /**
     * Utility constructor that assumes even division of times according to size
     * of keyValues and interpolation according to interpolators parameter.
     * 
     * @param keyValues
     *            values that the animation will assume at each of the
     *            corresponding times in keyTimes
     * @param interpolators
     *            collection of Interpolators that control the calculation of
     *            values in each of the intervals defined by keyFrames. If this
     *            value is null, a linear interpolator will be used for
     *            all intervals. If there is only one interpolator, that
     *            interpolator will be used for all intervals. Otherwise, there
     *            must be a number of interpolators equal to the number of
     *            intervals (which is one less than the number of keyTimes).
     * @throws IllegalArgumentException
     *             The number of interpolators must either be zero
     *             (interpolators == null), one, or one less than the size of
     *             keyTimes.
     */

// Path: projects/main/src/main/java/libshapedraw/animation/trident/ease/TimelineEase.java
// public interface TimelineEase {
// 	public float map(float durationFraction);
// }


// Path: projects/main/src/main/java/libshapedraw/animation/trident/interpolator/KeyFrames.java
import libshapedraw.animation.trident.ease.TimelineEase;

// original package: org.pushingpixels.trident.interpolator
// imported from http://kenai.com/projects/trident/ (version 1.3)
/**
 * Copyright (c) 2006, Sun Microsystems, Inc
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 
 *   * Redistributions of source code must retain the above copyright
 *     notice, this list of conditions and the following disclaimer.
 *   * Redistributions in binary form must reproduce the above
 *     copyright notice, this list of conditions and the following 
 *     disclaimer in the documentation and/or other materials provided 
 *     with the distribution.
 *   * Neither the name of the TimingFramework project nor the names of its
 *     contributors may be used to endorse or promote products derived 
 *     from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package libshapedraw.animation.trident.interpolator;


/**
 * 
 * KeyFrames holds information about the times at which values are sampled
 * (KeyTimes) and the values at those times (KeyValues). It also holds
 * information about how to interpolate between these values for times that lie
 * between the sampling points.
 * 
 * @author Chet
 */
public class KeyFrames<T> {

    private KeyValues<T> keyValues;
    private KeyTimes keyTimes;
    private KeyInterpolators interpolators;

    /**
     * Simplest variation; determine keyTimes based on even division of 0-1
     * range based on number of keyValues. This constructor assumes LINEAR
     * interpolation.
     * 
     * @param keyValues
     *            values that will be assumed at each time in keyTimes
     */
    public KeyFrames(KeyValues<T> keyValues) {
        init(keyValues, null, (TimelineEase) null);
    }

    /**
     * This variant takes both keyValues (values at each point in time) and
     * keyTimes (times at which values are sampled).
     * 
     * @param keyValues
     *            values that the animation will assume at each of the
     *            corresponding times in keyTimes
     * @param keyTimes
     *            times at which the animation will assume the corresponding
     *            values in keyValues
     * @throws IllegalArgumentException
     *             keyTimes and keySizes must have the same number of elements
     *             since these structures are meant to have corresponding
     *             entries; an exception is thrown otherwise.
     */
    public KeyFrames(KeyValues<T> keyValues, KeyTimes keyTimes) {
        init(keyValues, keyTimes, (TimelineEase) null);
    }

    /**
     * Full constructor: caller provides an instance of all key* structures
     * which will be used to calculate between all times in the keyTimes list. A
     * null interpolator parameter is equivalent to calling
     * {@link KeyFrames#KeyFrames(KeyValues, KeyTimes)}.
     * 
     * @param keyValues
     *            values that the animation will assume at each of the
     *            corresponding times in keyTimes
     * @param keyTimes
     *            times at which the animation will assume the corresponding
     *            values in keyValues
     * @param interpolators
     *            collection of Interpolators that control the calculation of
     *            values in each of the intervals defined by keyFrames. If this
     *            value is null, a linear interpolator will be used for
     *            all intervals. If there is only one interpolator, that
     *            interpolator will be used for all intervals. Otherwise, there
     *            must be a number of interpolators equal to the number of
     *            intervals (which is one less than the number of keyTimes).
     * @throws IllegalArgumentException
     *             keyTimes and keyValues must have the same number of elements
     *             since these structures are meant to have corresponding
     *             entries; an exception is thrown otherwise.
     * @throws IllegalArgumentException
     *             The number of interpolators must either be zero
     *             (interpolators == null), one, or one less than the size of
     *             keyTimes.
     */
    public KeyFrames(KeyValues<T> keyValues, KeyTimes keyTimes,
            TimelineEase... interpolators) {
        init(keyValues, keyTimes, interpolators);
    }

    /**
     * Utility constructor that assumes even division of times according to size
     * of keyValues and interpolation according to interpolators parameter.
     * 
     * @param keyValues
     *            values that the animation will assume at each of the
     *            corresponding times in keyTimes
     * @param interpolators
     *            collection of Interpolators that control the calculation of
     *            values in each of the intervals defined by keyFrames. If this
     *            value is null, a linear interpolator will be used for
     *            all intervals. If there is only one interpolator, that
     *            interpolator will be used for all intervals. Otherwise, there
     *            must be a number of interpolators equal to the number of
     *            intervals (which is one less than the number of keyTimes).
     * @throws IllegalArgumentException
     *             The number of interpolators must either be zero
     *             (interpolators == null), one, or one less than the size of
     *             keyTimes.
     */

    public KeyFrames(KeyValues<T> keyValues, TimelineEase... interpolators) {
