public abstract class SimEntityBase extends BasicSimEntity
Modifier and Type | Field and Description |
---|---|
private static java.util.LinkedHashMap<java.lang.Class<?>,java.util.Map<java.lang.String,java.lang.reflect.Method>> |
allDoMethods
A two dimensional Hash table used to cache doMethods for all
SimEntityBases.
|
private static java.util.LinkedHashMap<java.lang.Class<?>,java.util.Map<java.lang.String,java.util.List<java.lang.Class<?>[]>>> |
allNamesAndSignatures
A two dimensional Hash table used to hold the names and signatures of all
doMethods of all SimEntityBases.
|
private static boolean |
debug
If true, print debug information.
|
private static java.util.logging.Logger |
LOGGER |
eventList, property
DEFAULT_ENTITY_NAME, DEFAULT_EVENT_NAME, DEFAULT_PRIORITY, EVENT_METHOD_PREFIX, NL
Constructor and Description |
---|
SimEntityBase()
Construct a new SimEntityBase with a default name and priority.
|
SimEntityBase(Priority priority)
Construct a new SimEntityBase with a default name and the given priority.
|
SimEntityBase(java.lang.String name)
Construct a new SimEntityBase with given name and a default priority.
|
SimEntityBase(java.lang.String name,
Priority priority)
Construct a new SimEntityBase with the given name and event priority.
|
Modifier and Type | Method and Description |
---|---|
static void |
coldReset()
Does not clear cache of doMethods and namesAndSignatures
|
void |
dumpDoMethods()
Prints out the "do" methods for this SimEntity
|
java.lang.String |
dumpDoMethodsStr()
Gets a String representation of this entity's event methods.
|
void |
dumpNamesAndSignatures()
Prints names and signatures of "do" methods to output specified by
Schedule.
|
java.lang.String |
dumpNamesAndSignaturesStr()
Produces a String containing the names and signatures of this entity's
"do" methods.
|
static java.lang.String |
getFullMethodName(java.lang.reflect.Method m)
Gets the method name plus signature as a String.
|
static java.lang.String |
getSignatureString(java.lang.reflect.Method m)
Get the signature of the given Method as a String.
|
void |
handleSimEvent(SimEvent event)
Process the given SimEvent.
|
static boolean |
isAssignableFrom(java.lang.Class<?>[] signature,
java.lang.Object[] args)
Determines if a event signature is equivalent to the given arguments.
|
static boolean |
isDebug() |
void |
processSimEvent(SimEvent event)
Process the given SimEvent.
|
static void |
setDebug(boolean b) |
void |
stopAtTime(double endingTime)
Interrupt all this SimEntity's events when a certain time is reached
|
void |
stopOnTime(double endingTime)
Deprecated.
- Use stopAtTime(double);
|
addPropertyChangeListener, addPropertyChangeListener, attemptSchedule, clearAddedProperty, compareTo, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAddedProperties, getEventList, getEventListID, getName, getPriority, getPropertiesString, getProperty, getProperty, getPropertyChangeListeners, getSerial, interrupt, interrupt, interruptAll, interruptAll, interruptAll, interruptAllWithArgs, interruptAllWithArgs, isClearAddedPropertiesOnReset, isJustDefinedProperties, isPersistant, isReRunnable, isVerbose, parametersMatch, removePropertyChangeListener, removePropertyChangeListener, reset, resetNextSerial, setClearAddedPropertiesOnReset, setEventList, setEventListID, setJustDefinedProperties, setName, setPersistant, setPriority, setProperty, setVerbose, toString, waitDelay, waitDelay, waitDelay, waitDelay
addSimEventListener, getSimEventListeners, notifyListeners, removeSimEventListener
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addSimEventListener, getSimEventListeners, notifyListeners, removeSimEventListener
private static final java.util.logging.Logger LOGGER
private static java.util.LinkedHashMap<java.lang.Class<?>,java.util.Map<java.lang.String,java.lang.reflect.Method>> allDoMethods
private static java.util.LinkedHashMap<java.lang.Class<?>,java.util.Map<java.lang.String,java.util.List<java.lang.Class<?>[]>>> allNamesAndSignatures
private static boolean debug
public SimEntityBase(java.lang.String name, Priority priority)
name
- The name of the entity.priority
- The default priority for processing this entity's events.public SimEntityBase()
public SimEntityBase(java.lang.String name)
name
- The name of the entity.public SimEntityBase(Priority priority)
priority
- The priority for processing this entity's events.public void handleSimEvent(SimEvent event)
handleSimEvent
in interface SimEventScheduler
handleSimEvent
in class BasicSimEntity
event
- Given SimEventpublic void processSimEvent(SimEvent event)
processSimEvent
in interface SimEventListener
processSimEvent
in class BasicSimEntity
event
- Given SimEventpublic java.lang.String dumpDoMethodsStr()
This method is added by TRAC-WSMR, Authot Lt Col Olson, USMC.
dumpDoMethodsStr
returns a String containing the same
information as dumpDoMethods
. This method allows a developer
to place the information in a graphical user interface, textbox, or
similar output device.
Method rewritten by A. Buss to use newer Iterator (vice Enumeration) and
to use StringBuilder
for speed. The underscores are also
made to exactly match the length of the heading.
public void dumpDoMethods()
public java.lang.String dumpNamesAndSignaturesStr()
This method is added by TRAC-WSMR, Authot Lt Col Olson, USMC.
dumpNamesAndSignaturesStr()
returns a String containing the
same information as dumpNamesAndSignatures()
. This method
allows a developer to place the information in a graphical user
interface, textbox, or similar output device.
A. Buss modified this to utilize Iterators and StringBuilder. Also, the corresponding old method now simply invokes this one.
public void dumpNamesAndSignatures()
public void stopOnTime(double endingTime)
endingTime
- The ending time at which all this SimEntity's events
are interrupted.public void stopAtTime(double endingTime)
endingTime
- The ending time at which all this SimEntity's events
are interrupted.public static void setDebug(boolean b)
b
- If true, print debug information.public static boolean isDebug()
public static java.lang.String getFullMethodName(java.lang.reflect.Method m)
m
- The method for which to get the full name (unfortunately the jdk
does not appear to provide this particular String...to my knowledge).public static java.lang.String getSignatureString(java.lang.reflect.Method m)
m
- The method for which to get the signature as a String
(unfortunately the jdk does not appear to provide this particular String
either...to my knowledge).public static boolean isAssignableFrom(java.lang.Class<?>[] signature, java.lang.Object[] args)
signature
- An array of the method's Classes.args
- An array containing the method's arguments as Objects.public static void coldReset()