Class BasicModelEntity
- All Implemented Interfaces:
ModelEntity
- Direct Known Subclasses:
BasicAgent,BasicDomain
In more detail, that is:
- unit identification (by name or address)
- managing in- and outports
- utility methods (model level, naming,
toString,equals) - providing relevant exceptions
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.simplesim.model.ModelEntity
ModelEntity.PortConnectionException, ModelEntity.PortOperationException, ModelEntity.UniqueConstraintViolationException -
Field Summary
Fields inherited from interface org.simplesim.model.ModelEntity
ROOT_LEVEL -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddToDomain(BasicDomain domain) Adds this entity to a domain.booleanTests if two model entities are equal (equality by identity)int[]Gets the entity address.Returns the full name of a model, concatenating the names of the parent entities.intgetLevel()Returns the level of the entity within the model hierarchygetName()Returns the name of this model entityReturns the parent domain of this model entity.voidRemoves this entity form its parent domain.toString()
-
Constructor Details
-
BasicModelEntity
public BasicModelEntity()
-
-
Method Details
-
addToDomain
Description copied from interface:ModelEntityAdds this entity to a domain.The domain becomes the parent of this entity.
Note: Connection management has to be done externally by the caller!
- Specified by:
addToDomainin interfaceModelEntity
-
removeFromDomain
public void removeFromDomain()Description copied from interface:ModelEntityRemoves 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.
- Specified by:
removeFromDomainin interfaceModelEntity
-
getName
Description copied from interface:ModelEntityReturns the name of this model entityReturns an empty string as default, may be overridden in derived classes.
- Specified by:
getNamein interfaceModelEntity- Returns:
- the name of this model entity, may be an empty string but not null
-
getFullName
Description copied from interface:ModelEntityReturns 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
- Specified by:
getFullNamein interfaceModelEntity- Returns:
- the full name of this entity
-
getParent
Description copied from interface:ModelEntityReturns the parent domain of this model entity.- Specified by:
getParentin interfaceModelEntity- Returns:
- the parent of this model
-
getAddress
public int[] getAddress()Description copied from interface:ModelEntityGets 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.- Specified by:
getAddressin interfaceModelEntity- Returns:
- the address
-
getInport
- Specified by:
getInportin interfaceModelEntity
-
getOutport
- Specified by:
getOutportin interfaceModelEntity
-
getLevel
public int getLevel()Description copied from interface:ModelEntityReturns 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.
- Specified by:
getLevelin interfaceModelEntity- Returns:
- the level of this entity in the model hierarchy
-
equals
Tests if two model entities are equal (equality by identity) -
toString
-