|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecthades.simulator.SimObject
hades.models.io.HexSwitch
HexSwitch: a 16-valued (4 bit) hex input switch. Signals are expected to be of type SignalStdLogic1164.
If the HexSwitch is visible, the currently selected value is indicated by a small Rectangle under the corresponding number. The value may be changed by clicking on a field, or by calling the setIndex() method.
Field Summary | |
protected java.lang.String |
bindkey
|
static int |
FIELD_SIZE
|
protected int |
index
|
static java.awt.Point |
offset
|
protected Rectangle |
rect
|
protected int |
startIndex
|
protected StdLogic1164 |
value_0
|
protected StdLogic1164 |
value_1
|
protected StdLogic1164 |
value_U
|
Fields inherited from class hades.simulator.SimObject |
classloader, console, debug, editor, name, parent, ports, propertySheet, simulator, symbol, versionId, visible |
Constructor Summary | |
HexSwitch()
HexSwitch(): create a HexSwitch simulation component |
Method Summary | |
void |
assign(java.lang.String hex,
double simTime)
assign: called by scripts or the StimuliGenerator to assign a new value for this HexSwitch at the given simulation time. |
void |
configure()
configure: display a dialog to specify the instance name, and bindkey |
void |
elaborate(java.lang.Object arg)
elaborate: initialize the switch symbol to the value 0. |
void |
evaluate(java.lang.Object arg)
evaluate: called by setIndex() as a reaction to interactive user events. |
java.lang.String |
getBindkey()
return the bindkey as a String. |
int |
getIndex()
|
int |
getStartIndex()
|
java.lang.String |
getToolTip(java.awt.Point position,
long millis)
construct a (short) tool tip message for a SimObject. |
void |
initGraphics()
|
boolean |
initialize(java.lang.String s)
initialize versionID, startIndex (default 0), and bindkey (default null). |
void |
keyPressed(java.awt.event.KeyEvent evt)
react to a KeyEvent. |
void |
mousePressed(java.awt.event.MouseEvent evt)
react to a MouseEvent. |
void |
scheduleOutputs(int index,
double time)
|
void |
setBindkey(java.lang.String s)
|
void |
setIndex(int index)
|
void |
setStartIndex(int i)
|
void |
setStartIndex(java.lang.String s)
|
void |
setSymbol(Symbol s)
|
java.lang.String |
toString()
generate a String with class name, instance name, and value. |
void |
updateDisplay()
update the HexSwitch graphical symbol. |
void |
wakeup(java.lang.Object arg)
wakeup: extract the Integer argument from the WakeupEvent, and use the resulting integer value as the index value for updating the graphical symbol of this HexSwitch (if visible). |
void |
write(java.io.PrintWriter ps)
write the versionID, startIndex, and bindkey. |
Methods inherited from class hades.simulator.SimObject |
constructDynamicSymbol, copy, getClassLoader, getDebug, getEditor, getExternalResources, getFullName, getName, getParent, getPort, getPorts, getPropertySheet, getResourceAsStream, getSimulator, getSymbol, getSymbolResourceName, getVersionId, isVisible, message, 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 |
Methods inherited from interface hades.simulator.Simulatable |
message |
Field Detail |
protected int index
protected int startIndex
protected StdLogic1164 value_0
protected StdLogic1164 value_1
protected StdLogic1164 value_U
protected Rectangle rect
protected java.lang.String bindkey
public static final int FIELD_SIZE
public static final java.awt.Point offset
Constructor Detail |
public HexSwitch()
Method Detail |
public void setSymbol(Symbol s)
setSymbol
in class SimObject
public void initGraphics()
public void mousePressed(java.awt.event.MouseEvent evt)
SimObject
Note that the HADES schematic editor will also deliver jfig.canvas.FigCanvasEvent object, which also include the world-coordinates of the Event.
mousePressed
in class SimObject
public void keyPressed(java.awt.event.KeyEvent evt)
SimObject
At the moment this is actually called from KeyHandler.keyTyped(), but this naming mismatch is not considered critical...
keyPressed
in class SimObject
public void updateDisplay()
public void configure()
configure
in class SimObject
public int getIndex()
public void setIndex(int index)
public int getStartIndex()
public void setStartIndex(int i)
public void setStartIndex(java.lang.String s)
public java.lang.String getBindkey()
SimObject
Returns the lowercase bindkey character as a String; this key is used by KeyHandler to check whether this SimObject should be activated (via keyPressed()) in view-mode. We return null here. Should be overridden by SimObject's that want to be notified by and react to global key-events on the main editor canvas.
If you plan to enable a bindkey for your SimObject, please: override getBindkey(), implement setBindkey() - e.g. via NameMangler.getBindkey(), change write() to write the bindkey string, change initialize() to parse the bindkey string, modify getToolTip() to print the bindkey, and change configure() to allow setting the bindkey.
getBindkey
in class SimObject
public void setBindkey(java.lang.String s)
public void elaborate(java.lang.Object arg)
elaborate
in interface Simulatable
elaborate
in class SimObject
public void evaluate(java.lang.Object arg)
evaluate
in interface Simulatable
evaluate
in class SimObject
arg
- an arbitrary object argumentpublic void scheduleOutputs(int index, double time)
public void wakeup(java.lang.Object arg)
wakeup
in interface Wakeable
public void assign(java.lang.String hex, double simTime)
Note that this method also tries to update the graphical symbol of this HexSwitch (if visible), by scheduling a WakeupEvent.
assign
in interface Assignable
public void write(java.io.PrintWriter ps)
write
in class SimObject
public boolean initialize(java.lang.String s)
initialize
in class SimObject
public java.lang.String getToolTip(java.awt.Point position, long millis)
SimObject
getToolTip
in interface ContextToolTip
getToolTip
in class SimObject
public java.lang.String toString()
toString
in class SimObject
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |