public class SchemeInstance extends MoiseElement implements ToXML
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<java.lang.String,GoalInstance> |
goals |
protected java.util.Set<GroupInstance> |
groups |
protected int |
number |
protected OE |
oe |
protected java.util.Set<PlanInstance> |
plans |
protected java.util.Set<MissionPlayer> |
players |
protected GoalInstance |
root |
protected Scheme |
spec |
static java.lang.String |
WellFormed |
debug
Modifier | Constructor and Description |
---|---|
protected |
SchemeInstance(java.lang.String id,
Scheme sch) |
Modifier and Type | Method and Description |
---|---|
void |
abort()
remove all commitments without checking goal state
|
protected void |
addPlayer(MissionPlayer mp)
adds a mission player for this SCH
|
void |
addResponsibleGroup(GroupInstance g)
adds an instance group in the set of groups responsible for this SCH.
|
void |
addResponsibleGroup(java.lang.String grId)
adds an instance group in the set of groups responsible for this SCH.
|
java.util.Collection<OEAgent> |
getAgents()
gets all agents participating in this scheme
|
org.w3c.dom.Element |
getAsDOM(org.w3c.dom.Document document) |
GoalInstance |
getGoal(Goal gs) |
GoalInstance |
getGoal(java.lang.String goalId) |
java.util.Collection<GoalInstance> |
getGoals() |
int |
getNumber()
returns the unique number of the group (the getId uses this number to form the
unique id.
|
OE |
getOE() |
java.util.Collection<MissionPlayer> |
getPlayers() |
java.util.Collection<OEAgent> |
getPlayers(java.lang.String missionId)
returns the OEAgents committed to the missionId in this scheme
(if missionId is null, return all agents)
|
int |
getPlayersQty()
returns the total number of players in this sch
|
int |
getPlayersQty(java.lang.String missionId)
returns the number of missionId players in this scheme
|
java.util.Collection<GroupInstance> |
getResponsibleGroups()
returns a collection of groups that are responsible for this scheme
|
GoalInstance |
getRoot() |
Scheme |
getSpec()
returns the SCH specification for this SCH instance
|
static java.lang.String |
getUniqueId() |
static java.lang.String |
getXMLTag() |
boolean |
isCommitable()
returns true if this scheme's root goal is neither achieved nor impossible
|
boolean |
isPlayer(OEAgent ag) |
boolean |
isWellFormed()
returns true if the sch is well formed
|
void |
rebuildHash()
since serialisation of maps has a bug, we need to rebuild them after serialisation!
|
protected void |
removePlayer(MissionPlayer mp)
removes a mission player from this scheme (no checks are done)
|
void |
remResponsibleGroup(GroupInstance g)
removes an instance group in the set of groups responsible for this SCH.
|
void |
remResponsibleGroup(java.lang.String grId)
removes an instance group in the set of groups responsible for this SCH.
|
protected void |
setOE(OE oe) |
java.lang.String |
wellFormedStatus()
returns "ok" (SchemeInstance.WellFormed) if the sch 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
public static final java.lang.String WellFormed
protected Scheme spec
protected GoalInstance root
protected int number
protected OE oe
protected java.util.Set<MissionPlayer> players
protected java.util.Set<GroupInstance> groups
protected java.util.Map<java.lang.String,GoalInstance> goals
protected java.util.Set<PlanInstance> plans
protected SchemeInstance(java.lang.String id, Scheme sch) throws MoiseConsistencyException
MoiseConsistencyException
public void rebuildHash()
public static java.lang.String getUniqueId()
protected void setOE(OE oe)
public OE getOE()
public GoalInstance getRoot()
public Scheme getSpec()
public int getNumber()
public void addResponsibleGroup(java.lang.String grId) throws MoiseConsistencyException
Example: sch.addResponsibleGroup(def.getId());
grId
- the group IdMoiseConsistencyException
- the grIs does not exist in the OEpublic void addResponsibleGroup(GroupInstance g) throws MoiseConsistencyException
Example: sch.addResponsibleGroup(def);
g
- the group objectMoiseConsistencyException
- the group is not well formedpublic void remResponsibleGroup(java.lang.String grId) throws MoiseConsistencyException
Example: sch.remResponsibleGroup("gr_def22");
grId
- the group idMoiseConsistencyException
- no agent of group g can be committed to missions in this schemepublic void remResponsibleGroup(GroupInstance g) throws MoiseConsistencyException
Example: sch.remResponsibleGroup(def);
g
- the group objectMoiseConsistencyException
- no agent of group g can be committed to missions in this schemepublic java.util.Collection<GroupInstance> getResponsibleGroups()
public void abort() throws MoiseException
MoiseException
public java.lang.String wellFormedStatus()
public boolean isWellFormed()
public boolean isCommitable()
protected void addPlayer(MissionPlayer mp)
protected void removePlayer(MissionPlayer mp) throws MoiseException
MoiseException
public java.util.Collection<MissionPlayer> getPlayers()
public boolean isPlayer(OEAgent ag)
public java.util.Collection<OEAgent> getPlayers(java.lang.String missionId)
public java.util.Collection<OEAgent> getAgents()
public int getPlayersQty()
public int getPlayersQty(java.lang.String missionId)
public GoalInstance getGoal(java.lang.String goalId)
public GoalInstance getGoal(Goal gs)
public java.util.Collection<GoalInstance> getGoals()
public static java.lang.String getXMLTag()