hades.models.io
Class LED
java.lang.Object
hades.simulator.SimObject
hades.models.io.LED
- All Implemented Interfaces:
- java.lang.Cloneable, ColorSource, ContextToolTip, java.io.Serializable, Simulatable
- public class LED
- extends SimObject
- implements Simulatable, ColorSource
an animated light emitting diode.
LED: a simple subclass of SimObject that models an (red/green/yellow/blue)
light emitting diode (LED).
Note that LEDs are _not_ used as hierarchy connectors - you have to
use Opin instances to specify subdesign outputs.
You can specify the exact colors to use for red/green/yellow/blue LEDs
via the "Hades.LED.Colors." properties in aarrggbb
format, e.g. use "Hades.LED.Colors.red 0x007f0000" for a dark red LED.
- See Also:
- Serialized Form
Fields inherited from class hades.simulator.SimObject |
classloader, console, debug, editor, name, parent, ports, propertySheet, simulator, symbol, versionId, visible |
Constructor Summary |
LED()
LED(): simple constructor |
Method Summary |
void |
configure()
create and display a 'ConfigDialog' to set the parameters for
a SimObject. |
SimObject |
copy()
copy(): create a clone of the current LED, including its color |
void |
elaborate(java.lang.Object arg)
elaborate(): This method is called by the simulation engine
to initialize the simulation object. |
void |
evaluate(java.lang.Object arg)
evaluate(): called by the simulation engine on all events that
concern this object. |
java.awt.Color |
getColor()
get the current value of the Color from this ColorSource |
int |
getColorIndex()
|
boolean |
initialize(java.lang.String s)
initialize a LED from a String, which should contain the integer version
id and the index of the LED's color: 0=red, 1=green, 2=yellow, 3=blue,
e.g. |
void |
setColorIndex(java.lang.String s)
|
void |
setSymbol(Symbol s)
|
java.lang.String |
toString()
toString() - the usual info method |
void |
write(java.io.PrintWriter ps)
|
Methods inherited from class hades.simulator.SimObject |
constructDynamicSymbol, getBindkey, getClassLoader, getDebug, getEditor, getExternalResources, getFullName, getName, getParent, getPort, getPorts, getPropertySheet, getResourceAsStream, getSimulator, getSymbol, getSymbolResourceName, getToolTip, getVersionId, isVisible, keyPressed, message, mousePressed, needsDynamicSymbol, needsExternalResources, setClassLoader, setConsole, setDebug, setEditor, setName, setParent, setPorts, setSimulator, setVersionId, setVisible, tearDown |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
LED
public LED()
- LED(): simple constructor
setSymbol
public void setSymbol(Symbol s)
- Overrides:
setSymbol
in class SimObject
write
public void write(java.io.PrintWriter ps)
- Overrides:
write
in class SimObject
initialize
public boolean initialize(java.lang.String s)
- initialize a LED from a String, which should contain the integer version
id and the index of the LED's color: 0=red, 1=green, 2=yellow, 3=blue,
e.g. 1001 1 for a green LED.
- Overrides:
initialize
in class SimObject
getColorIndex
public int getColorIndex()
setColorIndex
public void setColorIndex(java.lang.String s)
configure
public void configure()
- Description copied from class:
SimObject
- create and display a 'ConfigDialog' to set the parameters for
a SimObject. The default ConfigDialog for the base class (SimObject)
itself is empty except for the 'instance name' of the SimObject.
- Overrides:
configure
in class SimObject
elaborate
public void elaborate(java.lang.Object arg)
- elaborate(): This method is called by the simulation engine
to initialize the simulation object.
- Specified by:
elaborate
in interface Simulatable
- Overrides:
elaborate
in class SimObject
- Parameters:
arg
- This parameter is ignored by LED
evaluate
public void evaluate(java.lang.Object arg)
- evaluate(): called by the simulation engine on all events that
concern this object. The object is responsible for updating its
internal state and for scheduling all pending output events.
- Specified by:
evaluate
in interface Simulatable
- Overrides:
evaluate
in class SimObject
- Parameters:
arg
- An arbitrary and unused object
getColor
public java.awt.Color getColor()
- Description copied from interface:
ColorSource
- get the current value of the Color from this ColorSource
- Specified by:
getColor
in interface ColorSource
copy
public SimObject copy()
- copy(): create a clone of the current LED, including its color
- Overrides:
copy
in class SimObject
toString
public java.lang.String toString()
- toString() - the usual info method
- Overrides:
toString
in class SimObject