Package moise.oe
Class SchemeInstance
java.lang.Object
moise.common.MoiseElement
moise.oe.SchemeInstance
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable,Identifiable,ToXML
public class SchemeInstance extends MoiseElement implements ToXML
Represents the instance of one scheme Specification.
- Author:
- Jomi Fred Hubner
- See Also:
- Serialized Form
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<java.lang.String,GoalInstance>goalsprotected java.util.Set<GroupInstance>groupsprotected OEoeprotected java.util.Set<PlanInstance>plansprotected java.util.Set<MissionPlayer>playersprotected GoalInstancerootprivate static java.util.concurrent.atomic.AtomicIntegerschCountprivate static longserialVersionUIDprotected Schemespecstatic java.lang.StringWellFormedFields inherited from class moise.common.MoiseElement
debug -
Constructor Summary
Constructors Modifier Constructor Description protectedSchemeInstance(java.lang.String id, Scheme sch) -
Method Summary
Modifier and Type Method Description voidabort()remove all commitments without checking goal stateprotected voidaddPlayer(MissionPlayer mp)adds a mission player for this SCHvoidaddResponsibleGroup(java.lang.String grId)adds an instance group in the set of groups responsible for this SCH.voidaddResponsibleGroup(GroupInstance g)adds an instance group in the set of groups responsible for this SCH.java.util.Collection<OEAgent>getAgents()gets all agents participating in this schemeorg.w3c.dom.ElementgetAsDOM(org.w3c.dom.Document document)GoalInstancegetGoal(java.lang.String goalId)GoalInstancegetGoal(Goal gs)java.util.Collection<GoalInstance>getGoals()OEgetOE()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)intgetPlayersQty()returns the total number of players in this schintgetPlayersQty(java.lang.String missionId)returns the number of missionId players in this schemejava.util.Collection<GroupInstance>getResponsibleGroups()returns a collection of groups that are responsible for this schemeGoalInstancegetRoot()SchemegetSpec()returns the SCH specification for this SCH instancestatic java.lang.StringgetUniqueId()static java.lang.StringgetXMLTag()booleanisCommitable()returns true if this scheme's root goal is neither achieved nor impossiblebooleanisPlayer(OEAgent ag)booleanisWellFormed()returns true if the sch is well formedvoidrebuildHash()since serialisation of maps has a bug, we need to rebuild them after serialisation!protected voidremovePlayer(MissionPlayer mp)removes a mission player from this scheme (no checks are done)voidremResponsibleGroup(java.lang.String grId)removes an instance group in the set of groups responsible for this SCH.voidremResponsibleGroup(GroupInstance g)removes an instance group in the set of groups responsible for this SCH.protected voidsetOE(OE oe)java.lang.StringwellFormedStatus()returns "ok" (SchemeInstance.WellFormed) if the sch is well formed, otherwise returns the problems' descriptionMethods inherited from class moise.common.MoiseElement
compareTo, equals, getBoolProperty, getBoolProperty, getCreationDate, getFullId, getId, getId, getOwner, getPrefix, getPrefix, getProperties, getPropertiesAsDOM, getPropertiesAsProlog, getProperty, getStrProperty, hashCode, setId, setOwner, setPrefix, setPropertiesFromDOM, setProperty, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
- Constant Field Values
-
WellFormed
public static final java.lang.String WellFormed- See Also:
- Constant Field Values
-
spec
-
root
-
oe
-
players
-
groups
-
goals
-
plans
-
schCount
private static java.util.concurrent.atomic.AtomicInteger schCount
-
-
Constructor Details
-
SchemeInstance
- Throws:
MoiseConsistencyException
-
-
Method Details
-
rebuildHash
public void rebuildHash()since serialisation of maps has a bug, we need to rebuild them after serialisation! -
getUniqueId
public static java.lang.String getUniqueId() -
setOE
-
getOE
-
getRoot
-
getSpec
returns the SCH specification for this SCH instance -
addResponsibleGroup
adds an instance group in the set of groups responsible for this SCH.Example:
sch.addResponsibleGroup(def.getId());- Parameters:
grId- the group Id- Throws:
MoiseConsistencyException- the grIs does not exist in the OE
-
addResponsibleGroup
adds an instance group in the set of groups responsible for this SCH.Example:
sch.addResponsibleGroup(def);- Parameters:
g- the group object- Throws:
MoiseConsistencyException- the group is not well formed
-
remResponsibleGroup
removes an instance group in the set of groups responsible for this SCH.Example:
sch.remResponsibleGroup("gr_def22");- Parameters:
grId- the group id- Throws:
MoiseConsistencyException- no agent of group g can be committed to missions in this scheme
-
remResponsibleGroup
removes an instance group in the set of groups responsible for this SCH.Example:
sch.remResponsibleGroup(def);- Parameters:
g- the group object- Throws:
MoiseConsistencyException- no agent of group g can be committed to missions in this scheme
-
getResponsibleGroups
returns a collection of groups that are responsible for this scheme -
abort
remove all commitments without checking goal state- Throws:
MoiseException
-
wellFormedStatus
public java.lang.String wellFormedStatus()returns "ok" (SchemeInstance.WellFormed) if the sch is well formed, otherwise returns the problems' description -
isWellFormed
public boolean isWellFormed()returns true if the sch is well formed -
isCommitable
public boolean isCommitable()returns true if this scheme's root goal is neither achieved nor impossible -
addPlayer
adds a mission player for this SCH -
removePlayer
removes a mission player from this scheme (no checks are done)- Throws:
MoiseException
-
getPlayers
-
isPlayer
-
getPlayers
returns the OEAgents committed to the missionId in this scheme (if missionId is null, return all agents) -
getAgents
gets all agents participating in this scheme -
getPlayersQty
public int getPlayersQty()returns the total number of players in this sch -
getPlayersQty
public int getPlayersQty(java.lang.String missionId)returns the number of missionId players in this scheme -
getGoal
-
getGoal
-
getGoals
-
getXMLTag
public static java.lang.String getXMLTag() -
getAsDOM
public org.w3c.dom.Element getAsDOM(org.w3c.dom.Document document)
-