Package moise.oe

Class 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
    • Method Detail

      • 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

        protected void setOE​(OE oe)
      • getOE

        public OE getOE()
      • getSpec

        public Scheme getSpec()
        returns the SCH specification for this SCH instance
      • addResponsibleGroup

        public void addResponsibleGroup​(java.lang.String grId)
                                 throws MoiseConsistencyException
        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

        public void addResponsibleGroup​(GroupInstance g)
                                 throws MoiseConsistencyException
        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

        public void remResponsibleGroup​(java.lang.String grId)
                                 throws MoiseConsistencyException
        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

        public void remResponsibleGroup​(GroupInstance g)
                                 throws MoiseConsistencyException
        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

        public java.util.Collection<GroupInstance> getResponsibleGroups()
        returns a collection of groups that are responsible for this scheme
      • 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

        protected void addPlayer​(MissionPlayer mp)
        adds a mission player for this SCH
      • getPlayers

        public java.util.Collection<MissionPlayer> getPlayers()
      • isPlayer

        public boolean isPlayer​(OEAgent ag)
      • getPlayers

        public 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)
      • getAgents

        public java.util.Collection<OEAgent> 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

        public GoalInstance getGoal​(java.lang.String goalId)
      • getGoals

        public java.util.Collection<GoalInstance> getGoals()
      • getXMLTag

        public static java.lang.String getXMLTag()
      • getAsDOM

        public org.w3c.dom.Element getAsDOM​(org.w3c.dom.Document document)
        Specified by:
        getAsDOM in interface ToXML