Triveni

triveni.demo.counter
Class Counter

java.lang.Object
  |
  +--triveni.Communicator
        |
        +--triveni.Activity
              |
              +--triveni.demo.counter.Counter

public class Counter
extends Activity
implements triveni.demo.counter.EventLabels

A bounded counter implemented as an activity. The current value of the counter is visualized as the position of a button in a rectangle whose height is the maximum value times the height of the button. The counter emits OUCH when the maximum value is reached and PRESSED when the button is pressed.


Fields inherited from interface triveni.demo.counter.EventLabels
DOWN, OUCH, OVERFLOW, PRESSED, RESET, TICK, UP
 
Constructor Summary
Counter(java.awt.Container container, java.lang.String buttonName, int numSteps)
          Creates a bounded counter whose button has default width and height.
Counter(java.awt.Container container, java.lang.String buttonName, int numSteps, int width, int height)
          Creates a bounded counter.
 
Method Summary
 void update(LabeledEvent evt)
          Raises the button on UP, lowers it on DOWN, and resets it on RESET.
 
Methods inherited from class triveni.Activity
clearQuiescent, clone, emitEvent, emitEvent, emitEvent, emitInterruptibly, emitInterruptibly, emitInterruptibly, isQuiescent, isStopped, isSuspended, onEmit, onResume, onStart, onStop, onSuspend, setQuiescent, setUpdateHandler
 
Methods inherited from class triveni.Communicator
addLabeledListener, addRelevantLabel, addRelevantLabels, fireEvent, getRelevantLabels, removeLabeledListener, removeRelevantLabel, setRelevantLabels, setRelevantLabels
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Counter

public Counter(java.awt.Container container,
               java.lang.String buttonName,
               int numSteps,
               int width,
               int height)
Creates a bounded counter.
Parameters:
container - the container in which the GUI components of this counter are placed.
buttonName - the label of the button.
numSteps - the maximum value of the counter.
width - the width of the button.
height - the width of the button.

Counter

public Counter(java.awt.Container container,
               java.lang.String buttonName,
               int numSteps)
Creates a bounded counter whose button has default width and height.
Method Detail

update

public void update(LabeledEvent evt)
Raises the button on UP, lowers it on DOWN, and resets it on RESET.
Overrides:
update in class Activity
Tags copied from class: Activity
Throws:
java.lang.InterruptedException - when the current thread is interrupted.
See Also:
Activity.setUpdateHandler(Expr)

Triveni

http://www.cs.luc.edu/triveni/