|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecthades.simulator.SimObject
SimObject - an example stub class that implements the Simulatable interface and may be subclassed for concrete simulation objects
Field Summary | |
protected java.lang.ClassLoader |
classloader
|
protected Console |
console
|
protected static boolean |
debug
|
protected Editor |
editor
|
protected java.lang.String |
name
|
protected SimObject |
parent
|
protected Port[] |
ports
|
protected PropertySheet |
propertySheet
|
protected SimKernel |
simulator
|
protected Symbol |
symbol
|
protected long |
versionId
|
protected boolean |
visible
|
Constructor Summary | |
SimObject()
simple default constructor. |
Method Summary | |
void |
configure()
create and display a 'ConfigDialog' to set the parameters for a SimObject. |
void |
constructDynamicSymbol()
|
SimObject |
copy()
copy(): This function is used to create a clone of the current SimObject. |
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.lang.String |
getBindkey()
return the bindkey as a String. |
java.lang.ClassLoader |
getClassLoader()
|
boolean |
getDebug()
|
Editor |
getEditor()
|
java.lang.String[] |
getExternalResources()
return a String array with all external resources required by the current SimObject. |
java.lang.String |
getFullName()
get the full (hierarchical) name of this object |
java.lang.String |
getName()
get the name of this object |
SimObject |
getParent()
get a reference to the parent of this SimObject, if any |
Port |
getPort(java.lang.String name)
get a reference to a port called 'name' if any |
Port[] |
getPorts()
get a list of Ports on this SimObject |
java.awt.Component |
getPropertySheet()
return a reference to the 'property sheet' or configuration window for this SimObject. |
java.io.InputStream |
getResourceAsStream(java.lang.String s)
get an InputStream for the CLASSPATH resource specified by String s. |
SimKernel |
getSimulator()
get a reference to the simulator for this SimObject |
Symbol |
getSymbol()
|
java.lang.String |
getSymbolResourceName()
construct a symbol resource name from the class name of SimObject or its respective derived class: prepend '/', replace '.' by '/', and append ".sym". |
java.lang.String |
getToolTip(java.awt.Point position,
long millis)
construct a (short) tool tip message for a SimObject. |
long |
getVersionId()
|
boolean |
initialize(java.lang.String s)
initialize a SimObject from a String. |
boolean |
isVisible()
|
void |
keyPressed(java.awt.event.KeyEvent ke)
react to a KeyEvent. |
void |
message(java.lang.String msg)
message(): print or display an information message. |
void |
mousePressed(java.awt.event.MouseEvent me)
react to a MouseEvent. |
boolean |
needsDynamicSymbol()
|
boolean |
needsExternalResources()
check whether this SimObject needs external resources, e.g. |
void |
setClassLoader(java.lang.ClassLoader CL)
|
void |
setConsole(Console console)
setConsole(): set a new Console for output messages |
void |
setDebug(boolean d)
|
void |
setEditor(Editor editor)
|
void |
setName(java.lang.String s)
set the name of this SimObject. |
void |
setParent(SimObject parent)
set the parent SimObject for this SimObject |
void |
setPorts(Port[] ports)
|
void |
setSimulator(SimKernel sim)
set a new simulation engine for this SimObject |
void |
setSymbol(Symbol symbol)
|
void |
setVersionId(long _id)
|
void |
setVisible(boolean v)
|
void |
tearDown()
tearDown(): called at the end of a simulation to clear up all references held by the SimObject. |
java.lang.String |
toString()
toString: generate a text description for this SimObject. |
void |
write(java.io.PrintWriter ps)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected Port[] ports
protected java.lang.String name
protected long versionId
protected SimObject parent
protected SimKernel simulator
protected Editor editor
protected java.lang.ClassLoader classloader
protected Symbol symbol
protected boolean visible
protected Console console
protected PropertySheet propertySheet
protected static boolean debug
Constructor Detail |
public SimObject()
Method Detail |
public java.lang.ClassLoader getClassLoader()
public void setClassLoader(java.lang.ClassLoader CL)
public java.io.InputStream getResourceAsStream(java.lang.String s)
public java.lang.String getName()
public java.lang.String getFullName()
public void setName(java.lang.String s)
To avoid consistency problems, when the user changes a SimObject's name interactively, we also try to enforce a unique name.
public SimObject getParent()
public void setParent(SimObject parent)
public Editor getEditor()
public void setEditor(Editor editor)
public SimKernel getSimulator()
public void setSimulator(SimKernel sim)
public Port[] getPorts()
public void setPorts(Port[] ports)
public Port getPort(java.lang.String name)
public boolean needsExternalResources()
public java.lang.String[] getExternalResources()
public java.lang.String getSymbolResourceName()
public Symbol getSymbol()
public void setSymbol(Symbol symbol)
public boolean needsDynamicSymbol()
public void constructDynamicSymbol()
public void setVisible(boolean v)
public boolean isVisible()
public void setDebug(boolean d)
public boolean getDebug()
public long getVersionId()
public void setVersionId(long _id)
public boolean initialize(java.lang.String s)
public void write(java.io.PrintWriter ps)
public void elaborate(java.lang.Object arg)
elaborate
in interface Simulatable
arg
- an arbitrary argumentpublic void evaluate(java.lang.Object arg)
evaluate
in interface Simulatable
arg
- an arbitrary object argumentpublic void tearDown()
public void configure()
public java.awt.Component getPropertySheet()
public void mousePressed(java.awt.event.MouseEvent me)
Note that the HADES schematic editor will also deliver jfig.canvas.FigCanvasEvent object, which also include the world-coordinates of the Event.
public void keyPressed(java.awt.event.KeyEvent ke)
At the moment this is actually called from KeyHandler.keyTyped(), but this naming mismatch is not considered critical...
public java.lang.String getBindkey()
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.
public SimObject copy()
I am not yet sure about the correct and best semantic for copy(). Currently a new object of the current class is created by calling the default constructor.
public void message(java.lang.String msg)
message
in interface Simulatable
public void setConsole(Console console)
public java.lang.String getToolTip(java.awt.Point position, long millis)
getToolTip
in interface ContextToolTip
public java.lang.String toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |