quicktime.app.actions
Class PeriodicAction

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

Deprecated. since QTJava 6.1

public abstract class PeriodicAction
extends java.lang.Object
implements Ticklish

This class is the base class for all periodically recurring time based actions. The Actionable object (if defined) will be an object that has its trigger method called when the PeriodicAction sub-class action is executed or when a constraining condition of the action is reached. The action is tickled periodically and whether it will do its action is dependant upon the time interval as specified by the scale and period and the time and effective rate of the tickle call.

Every time the action is executed the time is kept and consequent calls to tickle result in a comparison between the new time, the rate and the last time the action was executed. Whether the action is executed is calculated by:
if (currentTime <= period / scale * 1000 / effectiveRate + lastTime) at rate > 0.
The tickle method is not called with an effectiveRate of 0. Whether the doAction method is called can also be affected by a flag that controls whether an action is triggered depending on rate settings.


Field Summary
protected  Actionable actor
          Deprecated. since QTJava 6.1
protected  boolean reschedule
          Deprecated. since QTJava 6.1
 
Fields inherited from interface quicktime.app.time.Ticklish
kScale
 
Constructor Summary
protected PeriodicAction(int scale, int period)
          Deprecated. since QTJava 6.1
 
Method Summary
protected abstract  boolean constraintReached()
          Deprecated. since QTJava 6.1
protected abstract  void doAction(float er, int t)
          Deprecated. since QTJava 6.1
 boolean equals(java.lang.Object obj)
          Deprecated. since QTJava 6.1
 Actionable getActionable()
          Deprecated. since QTJava 6.1
 int getPeriod()
          Deprecated. since QTJava 6.1
 int getScale()
          Deprecated. since QTJava 6.1
 int getTriggerCondition()
          Deprecated. since QTJava 6.1
 void setActionable(Actionable actor)
          Deprecated. since QTJava 6.1
 void setPeriod(int period)
          Deprecated. since QTJava 6.1
 void setScale(int s)
          Deprecated. since QTJava 6.1
 void setTriggerCondition(int cond)
          Deprecated. since QTJava 6.1
 boolean tickle(float effectiveRate, int currentTime)
          Deprecated. since QTJava 6.1
 void timeChanged(int newTime)
          Deprecated. since QTJava 6.1
 java.lang.String toString()
          Deprecated. since QTJava 6.1
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

actor

protected Actionable actor
Deprecated. since QTJava 6.1

The actionable actor object that can be invoked by an action if a constraining condition is reached


reschedule

protected boolean reschedule
Deprecated. since QTJava 6.1

If true then the tickle method returns true and the action is considered to be still active by its owner and will be invoked on consequent tickles.

Constructor Detail

PeriodicAction

protected PeriodicAction(int scale,
                         int period)
Deprecated. since QTJava 6.1

Create a PeriodicAction. Subclasses are responsible for defining the action that occurs whenever the action is invoked.

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

timeChanged

public void timeChanged(int newTime)
                 throws QTException
Deprecated. since QTJava 6.1

This method should be called by the actions owner whenver a time condition of the owner's time line has changed, as this can effect the trigger conditions of the action.

Specified by:
timeChanged in interface Ticklish
QTException
See Also:
Ticklish

tickle

public boolean tickle(float effectiveRate,
                      int currentTime)
               throws QTException
Deprecated. since QTJava 6.1

This method can be called as often as you like, though effective rate cannot be zero. The provided time and rate values are used to calculate whether an action should be executed. If an action should be executed this method calls the doAction method which should perform the action.

Specified by:
tickle in interface Ticklish
Parameters:
effectiveRate - the effective rate of the Timer when the time condition matches
currentTime - the time that the Timer invoked the tickle method.
Returns:
true if the action is still interested in being tickled.
QTException

doAction

protected abstract void doAction(float er,
                                 int t)
                          throws QTException
Deprecated. since QTJava 6.1

This method is called by the tickle method when an action becomes active. Subclasses should do their desired actions when this method is called.

Parameters:
er - the actual rate at which the action has been triggered
t - the time in Ticklish.kScale that the action has been triggered
QTException

constraintReached

protected abstract boolean constraintReached()
Deprecated. since QTJava 6.1

If after the doAction method has exeucted this method returns true then if the Action has an Actionable object this actionable is triggered. If constraintReached returns false no further action is taken.

Returns:
true if the actionable object (if set) should be triggered

setActionable

public void setActionable(Actionable actor)
Deprecated. since QTJava 6.1

This method sets the actionable object of the action.


getActionable

public Actionable getActionable()
Deprecated. since QTJava 6.1

This method retreives the current actor that is attached to the action


setPeriod

public void setPeriod(int period)
Deprecated. since QTJava 6.1

Sets the current period of the action - how many scale ticks will elapse before the action is executed. If the period is zero the doAction method is called whenever the PeriodicAction is tickled.

Parameters:
period - the new period

getPeriod

public int getPeriod()
Deprecated. since QTJava 6.1

Returns the current period of the action

Returns:
the period

setScale

public void setScale(int s)
Deprecated. since QTJava 6.1

Sets the scale of the action - this is the resolution of a second at rate == 1, thus a scale of 10 is 100msecs at rate == 1, 50msecs at rate == 2 etc. This value must be greater than zero.

Parameters:
s - the new scale or resolution of the action

getScale

public int getScale()
Deprecated. since QTJava 6.1

Return the current scale of the action.

Returns:
the current scale

getTriggerCondition

public int getTriggerCondition()
Deprecated. since QTJava 6.1

Returns the trigger condition of the action - an action can trigger either when rate is positive, rate is negative or either.

Returns:
the current trigger condition
See Also:
quicktime.std.StdConstants.triggerTimeFwd, quicktime.std.StdConstants.triggerTimeBwd, quicktime.std.StdConstants.triggerTimeEither

setTriggerCondition

public void setTriggerCondition(int cond)
Deprecated. since QTJava 6.1

Sets the trigger condition of the action - an action can trigger either when rate is positive, rate is negative or either.

Parameters:
cond - the current trigger condition
See Also:
quicktime.std.StdConstants.triggerTimeFwd, quicktime.std.StdConstants.triggerTimeBwd, quicktime.std.StdConstants.triggerTimeEither

toString

public java.lang.String toString()
Deprecated. since QTJava 6.1

Return a String representation of this object.

Overrides:
toString in class java.lang.Object
Returns:
a String

equals

public boolean equals(java.lang.Object obj)
Deprecated. since QTJava 6.1

Returns true if the objects are equal or false otherwise.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to test
Returns:
a boolean