01: /*
02: *
03: *
04: * Copyright 1990-2007 Sun Microsystems, Inc. All Rights Reserved.
05: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
06: *
07: * This program is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU General Public License version
09: * 2 only, as published by the Free Software Foundation.
10: *
11: * This program is distributed in the hope that it will be useful, but
12: * WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * General Public License version 2 for more details (a copy is
15: * included at /legal/license.txt).
16: *
17: * You should have received a copy of the GNU General Public License
18: * version 2 along with this work; if not, write to the Free Software
19: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20: * 02110-1301 USA
21: *
22: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
23: * Clara, CA 95054 or visit www.sun.com if you need additional
24: * information or have any questions.
25: */
26: package com.sun.perseus.model;
27:
28: /**
29: * Represents a time interval in an animation.
30: *
31: * @version $Id: Segment.java,v 1.2 2006/04/21 06:38:37 st125089 Exp $
32: */
33: interface Segment {
34: /**
35: * @return the start value.
36: */
37: Object[] getStart();
38:
39: /**
40: * @return set end value.
41: */
42: Object[] getEnd();
43:
44: /**
45: * Computes this segment's length
46: */
47: float getLength();
48:
49: /**
50: * Collapses this segment with the one passed as a parameter.
51: * Note that if the input segment is not of the same class
52: * as this one, an IllegalArgumentException is thrown. The
53: * method also throws an exception if the input segment's
54: * end does not have the same number of components as this
55: * segment's end.
56: *
57: * After this method is called, this segment's end value
58: * is the one of the input <code>seg</code> parameter.
59: *
60: * @param seg the Segment to collapse with this one.
61: * @param anim the Animation this segment is part of.
62: */
63: void collapse(Segment seg, Animation anim);
64:
65: /**
66: * Adds the input value to this Segment's end value.
67: *
68: * @param by the value to add. Throws IllegalArgumentException if this
69: * Segment type is not additive or if the input value is incompatible (e.g.,
70: * different number of components or different number of dimensions on a
71: * component).
72: */
73: void addToEnd(Object[] by);
74:
75: /**
76: * @return true if this segment type supports addition. false
77: * otherwise.
78: */
79: boolean isAdditive();
80:
81: /**
82: * Sets the start value to its notion of 'zero'
83: */
84: void setZeroStart();
85:
86: /**
87: * Sets the start value.
88: *
89: * @param newStart the new segment start value.
90: */
91: void setStart(Object[] newStart);
92:
93: /**
94: * Should be called after the segment's configuration is complete
95: * to give the segment's implementation a chance to initialize
96: * internal data and cache values.
97: */
98: void initialize();
99: }
|