public abstract class PopulationBase extends AbstractSet<EntityInstance> implements EntityInstanceSet
Populations can only be created by the
Model.newPopulation(SchemaBase, Object)
method.
To access the EntityInstance in a populatrion, use either the
getFolder
or getExtent
method. These methods return
a set of all instance of a given entity type. The getFolders method
returns the set of instances whose type exactly matches the requested type,
while the getExtent method returns the instances in the folder, plus
all the subtypes of the specified entity.
Population implements the EntityInstanceSet inteface, to provide convientent
access to all of the entity instances contained within. This enable an
entiry population to be passed pased as a parameter to
EntityInstance.usedin
.
Modifier | Constructor and Description |
---|---|
protected |
PopulationBase(Model m,
Object id) |
Modifier and Type | Method and Description |
---|---|
void |
addInstance(EntityInstance inst)
Adds an EntityInstance to this population.
|
boolean |
contains(EntityInstance inst)
Determines if this population contains a specified instance.
|
EntityExtent |
getExtent(EntityDomain dom)
Get the entity extent for a specified type.
|
EntityExtent |
getExtent(String domname)
Get the entity extent for a specified type.
|
EntityExtent |
getFolder(EntityDomain dom)
Get the folder for a specified type.
|
EntityExtent |
getFolder(String domname)
Get the folder for a specified type.
|
Collection<EntityExtent> |
getFolders()
Get all the folders in this population.
|
Object |
getIdentifier()
Gets the identifier for the section
|
Model |
getModel()
Gets the model for the population
|
abstract SchemaBase |
getSchema()
Gets the schema for the population
|
boolean |
isUser()
Determines if this is a user population.
|
Iterator<EntityInstance> |
iterator()
Get all the instances in this population.
|
EntityInstance |
newInstance(EntityDomain dom)
Create a new instance of the specified instance
|
EntityInstance |
newInstance(List<StaticEntityDomain> sups)
Create a new complex instance within this population
|
EntityInstance |
newInstance(StaticEntityDomain[] sups)
Create a new complex instance within this population
|
void |
removeInstance(EntityInstance inst)
Remove an instance from the population.
|
int |
size()
Get the number of instances in this population.
|
equals, hashCode, removeAll
add, addAll, clear, contains, containsAll, isEmpty, remove, retainAll, toArray, toArray, toString
public abstract SchemaBase getSchema()
public final Model getModel()
public final Object getIdentifier()
public boolean isUser()
public final void addInstance(EntityInstance inst) throws TypeException
inst
- The instance to add.TypeException
- The instance is not of an entity in this
population's schemapublic final void removeInstance(EntityInstance inst) throws ModelMemberException
inst
- The instance to remove.ModelMemberException
- The requested instance was not in this
populationpublic final boolean contains(EntityInstance inst)
inst
- The instancetrue
if the specified instance is contained in
this model.public final EntityExtent getExtent(EntityDomain dom)
dom
- The requested type.public final EntityExtent getExtent(String domname) throws DomainNotFoundException
domname
- The name of the requested type.DomainNotFoundException
- There is no domain with the requested
name in the population's schema.public final EntityExtent getFolder(EntityDomain dom)
dom
- The requested type.public final EntityExtent getFolder(String domname) throws DomainNotFoundException
domname
- The name of the requested type.DomainNotFoundException
- There is no domain with the requested
name in the population's schema.public final Collection<EntityExtent> getFolders()
public final Iterator<EntityInstance> iterator()
iterator
in interface Iterable<EntityInstance>
iterator
in interface Collection<EntityInstance>
iterator
in interface Set<EntityInstance>
iterator
in class AbstractCollection<EntityInstance>
public final int size()
size
in interface Collection<EntityInstance>
size
in interface Set<EntityInstance>
size
in class AbstractCollection<EntityInstance>
public final EntityInstance newInstance(List<StaticEntityDomain> sups)
sups
- List of supertypes.null
if the
instance could not be createdTypeException
- The domain is not in the schema of this
population.public final EntityInstance newInstance(StaticEntityDomain[] sups)
sups
- Array of supertypes.null
if the
instance could not be createdTypeException
- The domain is not in the schema of this
population.public final EntityInstance newInstance(EntityDomain dom)
dom
- The domain of the instance.TypeException
- The domain is not in the schema of this
population.