Package jasima.core.simulation
Interface SimComponent
-
- All Superinterfaces:
Cloneable,Notifier<SimComponent,SimComponent.SimComponentEvent>,NotifierListener<Simulation,Simulation.SimLifecycleEvent>,SimLifecycleListener,SimOperations,ValueStore
- All Known Subinterfaces:
SimComponentContainer
- All Known Implementing Classes:
DynamicJobSource,JobSource,Shop,SimComponentBase,SimComponentContainerBase,SimComponentRoot,SimEntity,StaticJobSource,WorkStation
public interface SimComponent extends Notifier<SimComponent,SimComponent.SimComponentEvent>, SimLifecycleListener, ValueStore, Cloneable, SimOperations
This interface provides basic functionality for simulation components.- Author:
- Torsten Hildebrandt
- See Also:
Simulation
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classSimComponent.ProduceResultsEventMessage send when aSimComponentis requested to produce results.static interfaceSimComponent.SimComponentEventstatic classSimComponent.SimComponentLifeCycleMessage-
Nested classes/interfaces inherited from interface jasima.core.simulation.SimLifecycleListener
SimLifecycleListener.DoneListener, SimLifecycleListener.OtherListener, SimLifecycleListener.ResetStatsListener, SimLifecycleListener.ResultsListener, SimLifecycleListener.SimEndListener, SimLifecycleListener.SimInitialized, SimLifecycleListener.SimStartListener
-
Nested classes/interfaces inherited from interface jasima.core.simulation.util.SimOperations
SimOperations.SimEventType
-
-
Field Summary
Fields Modifier and Type Field Description static charNAME_SEPARATORThe separator used ingetHierarchicalName().
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default SimComponentContaineraddChild(SimComponent... scs)Adds one or more child nodes to the container.default voidaddComponent(SimComponent... scs)Convenience method to add a one or more new component(s) to the root component of this simulation.default voidaddResult(String name, Object value)Add a result to the simulation's result Map.SimComponentclone()Public clone method.default booleancontainsChild(SimComponent sc)Returnstrue, if this container contains the node given as a parameter.default voiddone()default SimComponentgetByHierarchicalName(String hierarchicalName)Returns the current component if this component's name matched the parameter.default SimComponentgetChild(int index)Returns the child identified byindex.default SimComponentgetChildByName(String name)Returns the child identified byname.default List<SimComponent>getChildren()Returns a list of all child components of this container.default StringgetHierarchicalName()Returns a base name for a SimComponent consisting of the hierarchical representation of the parent (getParent()), if it exists, and the (simple) name of the component's class.StringgetName()Gets the name of this component (must not be changed once set).SimComponentgetParent()Returns the container this component is contained in.SimulationgetSim()Returns the simulation this component is associated with.default voidhandleOther(Simulation sim, Simulation.SimLifecycleEvent event)default voidinform(Simulation sim, Simulation.SimLifecycleEvent event)default voidinit()booleanisInitialized()default booleanisValidName(String name)Notifier<SimComponent,SimComponent.SimComponentEvent>notifierImpl()SimComponents can notify registered listeners of certain events/messages occurring.default intnumChildren()Returns the number of children currently contained in this container.default voidproduceResults(Map<String,Object> res)default booleanremoveChild(SimComponent sc)Removes a child from this container.default voidremoveChildren()Removes all child nodes from this container.default voidresetStats()voidsetInitialized(boolean initStatus)SimComponentsetName(String name)voidsetParent(SimComponent p)Sets the container this component is contained in.voidsetSim(Simulation sim)Sets the simulation this component is part of.default voidsimEnd()default voidsimStart()ValueStorevalueStoreImpl()SimComponents provide aValueStoreto attach arbitrary key/value-pairs with them.-
Methods inherited from interface jasima.core.util.observer.Notifier
addListener, addListener, addListener, fire, fire, getListener, numListener, removeCurrentListener, removeListener
-
Methods inherited from interface jasima.core.simulation.util.SimOperations
activateEntity, currentPrio, end, getRootComponent, initRndGen, initRndGen, isEndRequested, isTraceEnabled, schedule, scheduleAt, scheduleAt, scheduleAt, scheduleAt, scheduleAt, scheduleAt, scheduleAt, scheduleAt, scheduleAt, scheduleAt, scheduleAt, scheduleAt, scheduleAt, scheduleAt, scheduleAt, scheduleAt, scheduleIn, scheduleIn, scheduleIn, scheduleIn, scheduleIn, scheduleIn, scheduleIn, scheduleIn, scheduleIn, scheduleIn, scheduleIn, scheduleIn, scheduleIn, scheduleIn, scheduleIn, scheduleIn, schedulePeriodically, schedulePeriodically, scheduleProcess, scheduleProcess, simTime, simTimeAbs, simTimeToInstant, toSimTime, toSimTime, toSimTime, trace
-
Methods inherited from interface jasima.core.util.ValueStore
valueStoreContains, valueStoreGet, valueStoreGet, valueStoreGetAllKeys, valueStoreGetNumKeys, valueStorePut, valueStoreRemove, valueStoreUpdate
-
-
-
-
Field Detail
-
NAME_SEPARATOR
static final char NAME_SEPARATOR
The separator used ingetHierarchicalName().- See Also:
- Constant Field Values
-
-
Method Detail
-
getSim
Simulation getSim()
Returns the simulation this component is associated with.- Specified by:
getSimin interfaceSimOperations
-
setSim
void setSim(Simulation sim)
Sets the simulation this component is part of.
-
getParent
@Nullable SimComponent getParent()
Returns the container this component is contained in.
-
setParent
void setParent(@Nullable SimComponent p)
Sets the container this component is contained in.
-
getName
String getName()
Gets the name of this component (must not be changed once set).
-
setName
SimComponent setName(String name)
-
isValidName
default boolean isValidName(String name)
-
isInitialized
boolean isInitialized()
-
setInitialized
void setInitialized(boolean initStatus)
-
init
default void init()
- Specified by:
initin interfaceSimLifecycleListener
-
simStart
default void simStart()
- Specified by:
simStartin interfaceSimLifecycleListener
-
resetStats
default void resetStats()
- Specified by:
resetStatsin interfaceSimLifecycleListener
-
simEnd
default void simEnd()
- Specified by:
simEndin interfaceSimLifecycleListener
-
done
default void done()
- Specified by:
donein interfaceSimLifecycleListener
-
produceResults
default void produceResults(Map<String,Object> res)
- Specified by:
produceResultsin interfaceSimLifecycleListener
-
handleOther
default void handleOther(Simulation sim, Simulation.SimLifecycleEvent event)
- Specified by:
handleOtherin interfaceSimLifecycleListener
-
inform
default void inform(Simulation sim, Simulation.SimLifecycleEvent event)
- Specified by:
informin interfaceNotifierListener<Simulation,Simulation.SimLifecycleEvent>- Specified by:
informin interfaceSimLifecycleListener
-
getHierarchicalName
default String getHierarchicalName()
Returns a base name for a SimComponent consisting of the hierarchical representation of the parent (getParent()), if it exists, and the (simple) name of the component's class.
-
getByHierarchicalName
default SimComponent getByHierarchicalName(String hierarchicalName)
Returns the current component if this component's name matched the parameter.- Parameters:
hierarchicalName- The name to check.- Returns:
- this, if name matches the parameter; null otherwise.
- See Also:
SimComponentContainer.getByHierarchicalName(String)
-
addComponent
default void addComponent(SimComponent... scs)
Description copied from interface:SimOperationsConvenience method to add a one or more new component(s) to the root component of this simulation.- Specified by:
addComponentin interfaceSimOperations
-
getChildren
default List<SimComponent> getChildren()
Returns a list of all child components of this container.
-
addChild
default SimComponentContainer addChild(SimComponent... scs)
Adds one or more child nodes to the container.- Returns:
- the container itself (to allow chaining calls)
-
removeChild
default boolean removeChild(SimComponent sc)
Removes a child from this container.- Parameters:
sc- the child to remove- Returns:
- true, if the child was removed; false otherwise
-
containsChild
default boolean containsChild(SimComponent sc)
Returnstrue, if this container contains the node given as a parameter.
-
removeChildren
default void removeChildren()
Removes all child nodes from this container.
-
numChildren
default int numChildren()
Returns the number of children currently contained in this container.
-
getChild
default SimComponent getChild(int index)
Returns the child identified byindex.- Parameters:
index- the child's index (0-based; range: [0, numChildren-1])- Returns:
- The child.
-
getChildByName
@Nullable default SimComponent getChildByName(String name)
Returns the child identified byname.- Parameters:
name- The child's name.- Returns:
- The child;
nullif not found.
-
addResult
default void addResult(String name, Object value)
Add a result to the simulation's result Map. If the given name starts with a dot, then the full component name (seegetHierarchicalName()) will be added as a name prefix.- Specified by:
addResultin interfaceSimOperations- See Also:
Simulation.addResult(String, Object)
-
notifierImpl
Notifier<SimComponent,SimComponent.SimComponentEvent> notifierImpl()
SimComponents can notify registered listeners of certain events/messages occurring. The default implementation ofSimComponentinforms listeners of lifecycle events such as INIT, DONE, etc.- Specified by:
notifierImplin interfaceNotifier<SimComponent,SimComponent.SimComponentEvent>
-
valueStoreImpl
ValueStore valueStoreImpl()
SimComponents provide aValueStoreto attach arbitrary key/value-pairs with them. This can be used as a simple extension mechanism without having to use inheritance.- Specified by:
valueStoreImplin interfaceValueStore
-
clone
SimComponent clone()
Public clone method. Implementing classes should implement a suitable functionality or throw aCloneNotSupportedExceptionwrapped in aRuntimeException.
-
-