sub_arctic.anim
Class anim_generator

java.lang.Object
  |
  +--sub_arctic.anim.anim_generator

public class anim_generator
extends java.lang.Object
implements java.lang.Runnable

This is the object which generates the animation events. It works by delivering a "fake" animation event (also known as a "tick"), then sleeping for a short period of time. Normally exactly one object of this class is created; it is created by the first call to "set_need_ticks(true)".


Field Summary
protected static java.lang.Thread _anim_thread
          The thread which is providing the animation ticks
protected static boolean _need_ticks
          Indication of whether we need the pulses at all.
protected static int _sleep_time
          This is how long we sleep between animation event generations (in milliseconds).
 
Method Summary
static boolean need_ticks()
          Return whether we need the animation events (ticks) or not.
 void run()
          This is the method that gets run on the thread.
static void set_need_ticks(boolean b)
          Set the state of tick (animation event) generation.
static void set_sleep_time(int x)
          Set the current amount of sleep time between animation events.
static int sleep_time()
          Retrieve the amount of time between animation events.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_sleep_time

protected static int _sleep_time
This is how long we sleep between animation event generations (in milliseconds). This defaults to 60.

_anim_thread

protected static java.lang.Thread _anim_thread
The thread which is providing the animation ticks

_need_ticks

protected static boolean _need_ticks
Indication of whether we need the pulses at all. The agent sets this value.
Method Detail

sleep_time

public static int sleep_time()
Retrieve the amount of time between animation events.
Returns:
int number of milliseconds between event generations

set_sleep_time

public static void set_sleep_time(int x)
Set the current amount of sleep time between animation events. The rate of animation events sets a lower bound on the accuracy of the animations (i.e. the size of the time intervals provided to animations.)

need_ticks

public static boolean need_ticks()
Return whether we need the animation events (ticks) or not. If not, we don't bother delivering animation inputs to the event dispatch system.

The animation agent will turn on ticks when it has objects in its queues, and turn off ticks when it has no objects to consider.

Returns:
boolean true if we currently need ticks.

set_need_ticks

public static void set_need_ticks(boolean b)
Set the state of tick (animation event) generation.
Parameters:
boolean - b true if we need to be generating ticks to the event dispatch code.

run

public void run()
This is the method that gets run on the thread. It delivers an ANIMATION_EVENT event to some AWT component with a subArctic interface installed under it (which one doesn't matter since the animation agent will deliver it to the focus regardless), then sleeps from a short period of time.
Specified by:
run in interface java.lang.Runnable