public class GroupInstance extends MoiseElement implements ToXML
Modifier and Type | Field and Description |
---|---|
protected int |
number |
protected OE |
oe |
protected java.util.Set<RolePlayer> |
players |
protected Group |
spec |
protected java.util.Map<java.lang.String,GroupInstance> |
subGroups |
protected GroupInstance |
superGroup |
debug
Modifier | Constructor and Description |
---|---|
protected |
GroupInstance(java.lang.String id,
Group spec)
create a new group instance identified by id
|
Modifier and Type | Method and Description |
---|---|
void |
addPlayer(RolePlayer rp)
adds a role player in this group
|
GroupInstance |
addSubGroup(java.lang.String grSpecId)
Adds a subgroup in a group, the id of the subgroup is defined automatically.
|
GroupInstance |
addSubGroup(java.lang.String grId,
java.lang.String grSpecId)
Adds a subgroup in a group.
|
void |
checkRemove() |
GroupInstance |
findGroup(java.lang.String grId)
looks for a group with grId in this Group (and its subgroups)
|
java.util.Collection<GroupInstance> |
findInstancesOf(Group grSpec)
get all groups (and subgroups) that instantiates grSpec
|
java.util.Set<OEAgent> |
getAgents(boolean includeSubGroups)
returns a collection with OEAgents belonging to this group
|
java.util.Collection<GroupInstance> |
getAllSubGroupsTree()
gets this group and all its sub groups, the sob-groups of the subgroups, .....
|
org.w3c.dom.Element |
getAsDOM(org.w3c.dom.Document document) |
Group |
getGrSpec() |
int |
getNumber()
returns the unique number of the group (the getId uses this number to form the
unique id.
|
java.util.Collection<RolePlayer> |
getPlayers()
returns an iterator for RolePlayer objects
|
java.util.Collection<RolePlayer> |
getPlayers(java.lang.String roleId,
boolean includeSubGroups)
returns the roleId players in this group (includeSubGroups==false)
or in this group and its subgroups (includeSubGroups==true).
|
int |
getPlayersQty()
returns the total number of players in this group (does not consider players in subgroups)
|
java.util.Collection<SchemeInstance> |
getRespSchemes()
returns a set of schemes which this group is responsible for
|
int |
getSubGroupInstacesQty()
returns the number of subgroups instances
|
int |
getSubGroupInstacesQty(java.lang.String grSpecId)
returns the number of grSpecId instances
|
java.util.Collection<GroupInstance> |
getSubGroups() |
GroupInstance |
getSuperGroup() |
static java.lang.String |
getUniqueId()
create a new group instance named automatically
|
static java.lang.String |
getXMLTag() |
boolean |
isWellFormed() |
void |
rebuildHash()
since serialisation of maps has a bug, we need to rebuild them after serialisation!
|
void |
removePlayer(RolePlayer rp)
removes a role player from this group
|
protected void |
removeRelations() |
void |
removeSubGroup(java.lang.String grId)
Removes a subgroup instance from this group.
|
protected void |
setOE(OE oe) |
protected void |
setSuperGroup(GroupInstance gr) |
java.lang.String |
wellFormedStatus()
returns "ok" if the group is well formed, otherwise returns the problems description
|
compareTo, equals, getBoolProperty, getBoolProperty, getCreationDate, getFullId, getId, getId, getOwner, getPrefix, getPrefix, getProperties, getPropertiesAsDOM, getPropertiesAsProlog, getProperty, getStrProperty, hashCode, setId, setOwner, setPrefix, setPropertiesFromDOM, setProperty, toString
protected Group spec
protected GroupInstance superGroup
protected OE oe
protected int number
protected java.util.Map<java.lang.String,GroupInstance> subGroups
protected java.util.Set<RolePlayer> players
protected GroupInstance(java.lang.String id, Group spec) throws MoiseConsistencyException
MoiseConsistencyException
public void rebuildHash()
public static java.lang.String getUniqueId()
public Group getGrSpec()
public int getNumber()
protected void setOE(OE oe)
protected void setSuperGroup(GroupInstance gr)
public GroupInstance getSuperGroup()
public boolean isWellFormed()
public java.lang.String wellFormedStatus()
public java.util.Collection<SchemeInstance> getRespSchemes()
public GroupInstance addSubGroup(java.lang.String grSpecId) throws MoiseException
Example:
Group def = team.addSubGroup("defense");
grId
- the id of the new groupgrSpecId
- the group specification identification (from OS)MoiseConsistencyException
- the grSpecId is not a subgroup of this groupMoiseCardinalityException
- the cardinality (the max subgroup is already achieved)MoiseException
public GroupInstance addSubGroup(java.lang.String grId, java.lang.String grSpecId) throws MoiseException
Example:
Group def = team.addSubGroup("d1", "defense");
grId
- the id of the new groupgrSpecId
- the group specification identification (from OS)MoiseConsistencyException
- the grSpecId is not a subgroup of this groupMoiseCardinalityException
- the cardinality (the max subgroup is already achieved)MoiseException
public void removeSubGroup(java.lang.String grId) throws MoiseConsistencyException
Example: att.removeSubGroup("gr_defense1");
grId
- the group instance idMoiseConsistencyException
- the grId is not a subgroup, the group has players, the group has subgroupsprotected void removeRelations() throws MoiseConsistencyException
MoiseConsistencyException
public void checkRemove() throws MoiseConsistencyException
MoiseConsistencyException
public int getSubGroupInstacesQty()
public int getSubGroupInstacesQty(java.lang.String grSpecId)
public java.util.Collection<GroupInstance> getSubGroups()
public java.util.Collection<GroupInstance> getAllSubGroupsTree()
public GroupInstance findGroup(java.lang.String grId)
public java.util.Collection<GroupInstance> findInstancesOf(Group grSpec)
public void addPlayer(RolePlayer rp)
public void removePlayer(RolePlayer rp)
public java.util.Collection<RolePlayer> getPlayers()
public int getPlayersQty()
public java.util.Collection<RolePlayer> getPlayers(java.lang.String roleId, boolean includeSubGroups)
public java.util.Set<OEAgent> getAgents(boolean includeSubGroups)
public static java.lang.String getXMLTag()