BasicEntity¶
- public abstract class BasicEntity<T> extends Entity implements Iterable<T>¶
Infrastructure class to enable the inheriting classes type-safe access to instances.
Constructors¶
BasicEntity¶
- BasicEntity(EntityBase impl)¶
Constructor
Methods¶
get¶
- public abstract T get()¶
Get the instance corresponding to a scalar entity.
- Throws
IllegalStateException
– if the entity has been deleted in the underlying AMPL interpreterUnsupportedOperationException
– if the entity is not scalar.
- Returns
The corresponding instance.
get¶
- public abstract T get(Object... key)¶
Get the instance corresponding to the specified key. See Access to instances and values for further information on how the key can be specified.
- Parameters
key – Key of the instance to be found.
- Throws
IllegalStateException
– if the entity has been deleted in the underlying AMPL interpreterIllegalArgumentException
– if trying to access an instance with the wrong number of keys (seeEntity.indexarity
)
- Returns
The instance corresponding to the key, or
null
if the specified key is not found.
get¶
- public abstract T get(Tuple key)¶
Get the instance corresponding to the specified tuple. See Access to instances and values for further information on how the key can be specified.
- Parameters
key – Key (in form of Tuple) of the instance to be found.
- Throws
IllegalStateException
– if the entity has been deleted in the underlying AMPL interpreterIllegalArgumentException
– if trying to access an instance with the wrong number of keys (seeEntity.indexarity
)
- Returns
The instance corresponding to the key, or
null
if the specified key is not found.