Interface ModelEntity
- All Known Implementing Classes:
BasicAgent
,BasicDomain
,BasicModelEntity
,Cell
,DynamicElevator
,DynamicModel
,DynamicVisitor
,Floor
,InstrumentationDecorator
,Model
,RoutingAgent
,RoutingDomain
,SimpleAgent
,SimpleDomain
,StaticElevator
,StaticModel
,StaticVisitor
ModelEntity
is the core element of a simulation model. It
provides the most basic functionality needed by all entities of the model.
These are:
- unit identification (by name or address)
- managing in- and outports
- utility methods (parent reference, naming,
toString
,equals
) - providing relevant exceptions
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic final class
Exception to be thrown if a port cannot be connected or disconnected.static final class
Exception to be thrown if a port cannot be added or removed.static final class
Exception to be thrown if a duplicate object is used where only a unique one is allowed. -
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addToDomain
(BasicDomain domain) Adds this entity to a domain.int[]
Gets the entity address.Returns the full name of a model, concatenating the names of the parent entities.int
getLevel()
Returns the level of the entity within the model hierarchygetName()
Returns the name of this model entityReturns the parent domain of this model entity.void
Removes this entity form its parent domain.
-
Field Details
-
ROOT_LEVEL
static final int ROOT_LEVEL- See Also:
-
-
Method Details
-
addToDomain
Adds this entity to a domain.The domain becomes the parent of this entity.
Note: Connection management has to be done externally by the caller!
-
removeFromDomain
void removeFromDomain()Removes this entity form its parent domain.This method should never be called during a simulation cycle. If the entity could be removed from the domain, the entity's parent is set to null.
Note: Connection management has to be done externally by the caller.
-
getAddress
int[] getAddress()Gets the entity address. Can be null.Note: The address of the root domain is
int[0]
. Another dimension is added per model level. The value of each dimension is the index within the corresponding level.- Returns:
- the address
-
getName
String getName()Returns the name of this model entityReturns an empty string as default, may be overridden in derived classes.
- Returns:
- the name of this model entity, may be an empty string but not null
-
getFullName
String getFullName()Returns the full name of a model, concatenating the names of the parent entities.Example: If A and B are parents of this entity and this entity is named C, then the full name is A.B.C
- Returns:
- the full name of this entity
-
getParent
Domain getParent()Returns the parent domain of this model entity.- Returns:
- the parent of this model
-
getLevel
int getLevel()Returns the level of the entity within the model hierarchyModels may be organized in a hierarchy, so that each entity resides in a definite domain level of the model tree. The level information is generated when the getLevel() method is called first. The level of the root node is always 0.
- Returns:
- the level of this entity in the model hierarchy
-
getInport
Port getInport() -
getOutport
Port getOutport()
-