quicktime.app.actions
Class MatrixAction

java.lang.Object
  |
  +--quicktime.app.actions.PeriodicAction
        |
        +--quicktime.app.actions.MatrixAction
All Implemented Interfaces:
Targetable, Ticklish
Direct Known Subclasses:
BounceAction

public 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.


Field Summary
protected  boolean doConstraintBoundsTesting
          Set this boolean to true or false to perform bounds testing of the target within the bounds of its enclosing Space.
protected static int kBottomSide
          These constants are used in the boundsReached call to indicate to the subclass which edge the target has collided with.
protected static int kLeftSide
          These constants are used in the boundsReached call to indicate to the subclass which edge the target has collided with.
protected static int kRightSide
          These constants are used in the boundsReached call to indicate to the subclass which edge the target has collided with.
protected static int kTopSide
          These constants are used in the boundsReached call to indicate to the subclass which edge the target has collided with.
protected  Transformable target
          The target of the matrix transformations
protected  TransformMatrix transMatrix
          This is the class that will do the transformations on the target's matrix
 
Fields inherited from class quicktime.app.actions.PeriodicAction
actor, reschedule
 
Fields inherited from interface quicktime.app.time.Ticklish
kScale
 
Constructor Summary
  MatrixAction(int scale, int period, QTDisplaySpace space, Transformable t, TransformMatrix transformMatrixAction)
          Create a MatrixAction that will act upon a Matrix.
protected MatrixAction(int scale, int period, QTDrawable space, Transformable t)
          Deprecated. since QTJava 4
 
Method Summary
protected  void boundsReached(int whichSide)
          Deprecated. since QTJava 4
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.
protected  void doAction(float er, int t)
          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.
 boolean equals(java.lang.Object obj)
          Returns true if the incoming object is a Matrix action with the same target.
 QTDrawable getSpace()
          Deprecated. since QTJava 4
 java.lang.Object getTarget()
          Deprecated. since QTJava 4
protected  void rateDirectionChanged(boolean forwards)
          Deprecated. since QTJava 4
 void setSpace(QTDrawable space)
          Deprecated. since QTJava 4
 void setTarget(java.lang.Object target)
          Deprecated. since QTJava 4
protected  void setTargetMatrix(Matrix transformedMatrix)
          Deprecated. since QTJava 4
 java.lang.String toString()
          Return a string representation of this class.
protected  void transformMatrix(Matrix theMatrix)
          Deprecated. since QTJava 4
 
Methods inherited from class quicktime.app.actions.PeriodicAction
getActionable, getPeriod, getScale, getTriggerCondition, setActionable, setPeriod, setScale, setTriggerCondition, tickle, timeChanged
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface quicktime.app.time.Ticklish
tickle, timeChanged
 

Field Detail

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

transMatrix

protected TransformMatrix transMatrix
This is the class that will do the transformations on the target's matrix

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.
Constructor Detail

MatrixAction

protected MatrixAction(int scale,
                       int period,
                       QTDrawable space,
                       Transformable t)
                throws QTException
Deprecated. since QTJava 4

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
See Also:
TransformMatrix

MatrixAction

public MatrixAction(int scale,
                    int period,
                    QTDisplaySpace space,
                    Transformable t,
                    TransformMatrix transformMatrixAction)
             throws QTException
Create a MatrixAction that will act upon a Matrix. It delegates the matrix transformation to the TransformMatrix object that is supplied in the constructor.
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
transformMatrixAction - the transformation that will be applied to the target's matrix every time this action is invoked.
Method Detail

setTarget

public void setTarget(java.lang.Object target)
Deprecated. since QTJava 4

Sets the target of the action. The target must be some kind of Transformable object.
Specified by:
setTarget in interface Targetable
Parameters:
target - a Transformable object
See Also:
TransformMatrix

getTarget

public java.lang.Object getTarget()
Deprecated. since QTJava 4

Returns the current target of the action.
Specified by:
getTarget in interface Targetable
Returns:
the current target
See Also:
TransformMatrix

getSpace

public QTDrawable getSpace()
Deprecated. since QTJava 4

The space which is the space that the transformable object is a member of.
Returns:
the enclosing space.
See Also:
TransformMatrix

setSpace

public void setSpace(QTDrawable space)
Deprecated. since QTJava 4

Set the space which is the space that the transformable target is a member of.
Parameters:
space - the enclosing space.
See Also:
TransformMatrix

doAction

protected void doAction(float er,
                        int t)
                 throws QTException
When called it performs three primary tasks: Once these tasks are performed the target's matrix is set to the transformed matrix through calling the setTargetMatrix with the transformed matrix.
Overrides:
doAction in class PeriodicAction
Parameters:
er - the rate at which the action was invoked.
t - the time at which the action was invoked.

rateDirectionChanged

protected void rateDirectionChanged(boolean forwards)
                             throws QTException
Deprecated. since QTJava 4

The Matrix action notifies subclasses when the rate at which an action is tickled changes from positive to negative or vice versa.
See Also:
TransformMatrix

transformMatrix

protected void transformMatrix(Matrix theMatrix)
                        throws QTException
Deprecated. since QTJava 4

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.
See Also:
TransformMatrix

boundsReached

protected void boundsReached(int whichSide)
Deprecated. since QTJava 4

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
See Also:
TransformMatrix

setTargetMatrix

protected void setTargetMatrix(Matrix transformedMatrix)
                        throws QTException
Deprecated. since QTJava 4

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
See Also:
TransformMatrix

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.
Overrides:
constraintReached in class PeriodicAction
Returns:
true if the actionable object (if set) should be triggered

toString

public java.lang.String toString()
Return a string representation of this class.
Overrides:
toString in class PeriodicAction
Following copied from class: quicktime.app.actions.PeriodicAction
Returns:
a String

equals

public boolean equals(java.lang.Object obj)
Returns true if the incoming object is a Matrix action with the same target.
Overrides:
equals in class PeriodicAction
Parameters:
obj - the object to test
Returns:
true if equal, false if not