public abstract class SimEntityBaseProtected 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
|
static java.util.logging.Logger |
log |
protected boolean |
reRunnable
True if the entity has a doRun method.
|
eventList, property
DEFAULT_ENTITY_NAME, DEFAULT_EVENT_NAME, DEFAULT_PRIORITY, EVENT_METHOD_PREFIX, NL
Constructor and Description |
---|
SimEntityBaseProtected()
Construct a new SimEntityBaseProtected with a default name and priority.
|
SimEntityBaseProtected(Priority priority)
Construct a new SimEntityBaseProtected with a default name and the given
priority.
|
SimEntityBaseProtected(java.lang.String name)
Construct a new SimEntityBaseProtected with given name and a default
priority.
|
SimEntityBaseProtected(java.lang.String name,
Priority priority)
Construct a new SimEntityBaseProtected with the given name and event
priority.
|
Modifier and Type | Method and Description |
---|---|
static void |
coldReset()
Clears 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.
|
protected java.util.Map<java.lang.String,java.lang.reflect.Method> |
getDoMethods()
This includes public, private,
and protected events defined anywhere in the inheritence.
|
static java.lang.String |
getFullMethodName(java.lang.reflect.Method m)
Gets the method name plus signature as a String.
|
static java.lang.String |
getFullMethodName(java.lang.reflect.Method m,
boolean wrap)
Gets a String containing the Method name plus the signature, with any
primitive parameters optionally wrapped in an Object.
|
static java.lang.String |
getFullMethodName(java.lang.String name,
java.lang.Class[] parameters,
boolean wrap)
Gets the method name plus signature as a String.
|
static java.lang.String |
getSignatureString(java.lang.reflect.Method m)
Gets the signature of the Method as a String, primative arguments are
displayed with the primative name (e.g, int)
|
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 equivelent to the given arguments.
|
static boolean |
isDebug() |
boolean |
isReRunnable()
Overrides BasicSimEntity to allow the doRun method to be protected or
private.
|
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, 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
public static final java.util.logging.Logger log
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
protected boolean reRunnable
private static boolean debug
public SimEntityBaseProtected(java.lang.String name, Priority priority)
name
- The name of the entity.priority
- The default priority for processing this entity's events.public SimEntityBaseProtected()
public SimEntityBaseProtected(java.lang.String name)
name
- The name of the entity.public SimEntityBaseProtected(Priority priority)
priority
- The priority for processing this entity's events.public boolean isReRunnable()
isReRunnable
in interface ReRunnable
isReRunnable
in class BasicSimEntity
protected java.util.Map<java.lang.String,java.lang.reflect.Method> getDoMethods()
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 informationpublic 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 getFullMethodName(java.lang.String name, java.lang.Class[] parameters, boolean wrap)
name
- The name of the method.parameters
- An array of Class objects that are the signature of the
method.wrap
- If true, primatives will be converted into Objects.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 java.lang.String getFullMethodName(java.lang.reflect.Method m, boolean wrap)
m
- Get the name of this Methodwrap
- If true wrap primitives in an Object. (e.g., "int" is
replaced by "java.lang.Integer"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()