All Packages Class Hierarchy This Package Previous Next Index
Class quicktime.app.actions.MatrixAction
java.lang.Object
|
+----quicktime.app.actions.PeriodicAction
|
+----quicktime.app.actions.MatrixAction
- public abstract class MatrixAction
- extends PeriodicAction
- implements Targetable
This class provides the means for a basic Matrix actions. Each time
the tickle method is called, it will retrieve the matrix from the target and
invoke the transformMatrix method, which the subclass must implement. The subclass
defines the transformMatrix method to apply a transformation to the matrix of the
target of the action.
The MatrixAction will also notify the subclass of any changes of rate direction
and if the subclass is interested in constraint testing will notify the subclass
which side(s) a targets matrix has collided with after the transformation has
been applied. These two states are notified with the rateDirectionChanged and
boundsReached methods respectively.
Though the Space is generally specified it is only used in the bounds testing.
-
doConstraintBoundsTesting
- Set this boolean to true or false to perform bounds testing of the
target within the bounds of its enclosing Space.
-
kBottomSide
- These constants are used in the boundsReached call to indicate to the
subclass which edge the target has collided with.
-
kLeftSide
- These constants are used in the boundsReached call to indicate to the
subclass which edge the target has collided with.
-
kRightSide
- These constants are used in the boundsReached call to indicate to the
subclass which edge the target has collided with.
-
kTopSide
- These constants are used in the boundsReached call to indicate to the
subclass which edge the target has collided with.
-
target
- The target of the matrix transformations
-
MatrixAction(int, int, QTDrawable, Transformable)
- Create a PeriodicAction that will act upon a Matrix.
-
boundsReached(int)
- If the Matrix action is doing constraint bounds testing and a bounding
condition is reached the Matrix action calls this method with one of four
flags to indicate which side of the enclosing space the target collided with.
-
constraintReached()
- Subclasses should return true if after an action is triggered (the doAction
method is called) the action has reached one of its specified constraint conditions
and the actionable object should be triggered.
-
doAction(float, int)
- When called it performs three primary tasks:
- (1) Checks to see if rate direction has changed - if so calls the rateDirectionChanged method
- (2) Calls the transformMatrix method which the subclass defines
- (3) If doConstraintBoundsTesting is true does bounds testing of the target within
the enclosing space and notifies of any collisions of the target with the space's sides.
-
equals(Object)
- Returns true if the incoming object is a Matrix action with the same target.
-
getSpace()
- The space which is the space that the transformable
object is a member of.
-
getTarget()
- Returns the current target of the action.
-
rateDirectionChanged(boolean)
- The Matrix action notifies subclasses when the rate at which an action is tickled changes
from positive to negative or vice versa.
-
setSpace(QTDrawable)
- Set the space which is the space that the transformable
target is a member of.
-
setTarget(Object)
- Sets the target of the action.
-
setTargetMatrix(Matrix)
- This method is invoked by the doAction method once the matrix has been
transformed.
-
toString()
- Return a string representation of this class.
-
transformMatrix(Matrix)
- The Matrix action calls the transformMatrix method with a Matrix that the subclass
should transform according to the particular transformation of the subclass.
kLeftSide
protected static final int kLeftSide
- These constants are used in the boundsReached call to indicate to the
subclass which edge the target has collided with. Horizontal and Vertical
sides are provided as a means for testing for both left and right,
up and down respectively.
kRightSide
protected static final int kRightSide
- These constants are used in the boundsReached call to indicate to the
subclass which edge the target has collided with. Horizontal and Vertical
sides are provided as a means for testing for both left and right,
up and down respectively.
kTopSide
protected static final int kTopSide
- These constants are used in the boundsReached call to indicate to the
subclass which edge the target has collided with. Horizontal and Vertical
sides are provided as a means for testing for both left and right,
up and down respectively.
kBottomSide
protected static final int kBottomSide
- These constants are used in the boundsReached call to indicate to the
subclass which edge the target has collided with. Horizontal and Vertical
sides are provided as a means for testing for both left and right,
up and down respectively.
target
protected Transformable target
- The target of the matrix transformations
doConstraintBoundsTesting
protected boolean doConstraintBoundsTesting
- Set this boolean to true or false to perform bounds testing of the
target within the bounds of its enclosing Space. Default is false.
If true the enclosing Space must be specified.
MatrixAction
protected MatrixAction(int scale,
int period,
QTDrawable space,
Transformable t) throws QTException
- Create a PeriodicAction that will act upon a Matrix.
- Parameters:
- scale - the amount with which a second is divided into at a rate of one
- period - the number of scale ticks that elapse between invocations of the action.
- space - the QTDrawable object that is the enclosing space of the Transformable target.
- t - a transformable object that will have its display matrix altered by the deltaMatrix
setTarget
public void setTarget(Object target)
- Sets the target of the action. The target must be some kind of Transformable object.
- Parameters:
- target - a Transformable object
getTarget
public Object getTarget()
- Returns the current target of the action.
- Returns:
- the current target
getSpace
public QTDrawable getSpace()
- The space which is the space that the transformable
object is a member of.
- Returns:
- the enclosing space.
setSpace
public void setSpace(QTDrawable space)
- Set the space which is the space that the transformable
target is a member of.
- Parameters:
- space - the enclosing space.
doAction
protected void doAction(float er,
int t) throws QTException
- When called it performs three primary tasks:
- (1) Checks to see if rate direction has changed - if so calls the rateDirectionChanged method
- (2) Calls the transformMatrix method which the subclass defines
- (3) If doConstraintBoundsTesting is true does bounds testing of the target within
the enclosing space and notifies of any collisions of the target with the space's sides.
Once these tasks are performed the target's matrix is set to the transformed matrix
through calling the setTargetMatrix with the transformed matrix.
- Parameters:
- er - the rate at which the action was invoked.
- t - the time at which the action was invoked.
- Overrides:
- doAction in class PeriodicAction
rateDirectionChanged
protected void rateDirectionChanged(boolean forwards) throws QTException
- The Matrix action notifies subclasses when the rate at which an action is tickled changes
from positive to negative or vice versa.
transformMatrix
protected abstract void transformMatrix(Matrix theMatrix) throws QTException
- The Matrix action calls the transformMatrix method with a Matrix that the subclass
should transform according to the particular transformation of the subclass.
- Parameters:
- theMatrix - the matrix to transform.
boundsReached
protected void boundsReached(int whichSide)
- If the Matrix action is doing constraint bounds testing and a bounding
condition is reached the Matrix action calls this method with one of four
flags to indicate which side of the enclosing space the target collided with.
- Parameters:
- whichSide - a flag that indicates which side
setTargetMatrix
protected void setTargetMatrix(Matrix transformedMatrix) throws QTException
- This method is invoked by the doAction method once the matrix has been
transformed. The default behaviour of this method is to just call the target's
setMatrix method with the transformed matrix.
- Parameters:
- transformedMatrix - the new matrix for the target
constraintReached
protected boolean constraintReached()
- Subclasses should return true if after an action is triggered (the doAction
method is called) the action has reached one of its specified constraint conditions
and the actionable object should be triggered. How this is defined is determined
totally by the subclass. This method will only be called by the tickle method
if the Action has an Actionable actor.
- Returns:
- true if the actionable object (if set) should be triggered
- Overrides:
- constraintReached in class PeriodicAction
toString
public String toString()
- Return a string representation of this class.
- Overrides:
- toString in class PeriodicAction
equals
public boolean equals(Object obj)
- Returns true if the incoming object is a Matrix action with the same target.
- Parameters:
- obj - the object to test
- Returns:
- true if equal, false if not
- Overrides:
- equals in class PeriodicAction
All Packages Class Hierarchy This Package Previous Next Index