public class GoalInstance extends MoiseElement implements ToXML, ToProlog
Modifier and Type | Class and Description |
---|---|
static class |
GoalInstance.GoalState |
Modifier and Type | Field and Description |
---|---|
protected java.util.List<OEAgent> |
achievedAgs |
protected java.util.Map<java.lang.String,java.lang.Object> |
args |
protected java.util.List<OEAgent> |
comAgs |
protected PlanInstance |
inPlan |
protected PlanInstance |
plan |
protected SchemeInstance |
sch |
protected Goal |
spec |
protected GoalInstance.GoalState |
state |
debug
Constructor and Description |
---|
GoalInstance(Goal sg,
SchemeInstance sch) |
Modifier and Type | Method and Description |
---|---|
void |
committed(OEAgent a)
adds the agent a in the set of agents committed to this goal
|
boolean |
equals(java.lang.Object o) |
java.util.Collection<OEAgent> |
getAchievedAgents() |
java.lang.Object |
getArgumentValue(java.lang.String arg) |
java.util.Map<java.lang.String,java.lang.Object> |
getArgumentValues()
returns all this goal arguments (key=argId, value=Object)
|
org.w3c.dom.Element |
getAsDOM(org.w3c.dom.Document document) |
java.lang.String |
getAsProlog() |
java.util.Collection<OEAgent> |
getCommittedAgents() |
PlanInstance |
getPlanToAchieve() |
SchemeInstance |
getScheme() |
Goal |
getSpec() |
GoalInstance.GoalState |
getState() |
static java.lang.String |
getXMLTag() |
boolean |
hasComittedAgents() |
int |
hashCode() |
boolean |
hasSuperGoalInState(GoalInstance.GoalState s) |
boolean |
isCommitted() |
boolean |
isEnabled()
returns true if this goal is
not satisfied yet,
the scheme is well formed
super goal is not satisfied,
super goal is not impossible,
|
boolean |
isImpossible() |
boolean |
isSatisfied()
a goal is achieved if enough committed agents have set it as satisfied
|
void |
setAchieved(OEAgent a)
sets that this goal is achieved by the agent a.
|
void |
setArgumentValue(java.lang.String arg,
java.lang.Object value)
set an argument's value for this instance goal
Example:
InstanceGoal gA = sch.getGoal("a");
gA.setArgumentValue("Z", "120"); |
void |
setImpossible(OEAgent a)
sets this goal as impossible to be achieved.
|
void |
setInPlan(PlanInstance pi) |
void |
setPlanToAchieve(PlanInstance pi)
set the plan that achieves this goal
|
java.lang.String |
toString() |
void |
uncommitted(OEAgent a)
removes the agent a in the set of agents committed to this goal
|
compareTo, getBoolProperty, getBoolProperty, getCreationDate, getFullId, getId, getId, getOwner, getPrefix, getPrefix, getProperties, getPropertiesAsDOM, getPropertiesAsProlog, getProperty, getStrProperty, setId, setOwner, setPrefix, setPropertiesFromDOM, setProperty
protected Goal spec
protected PlanInstance inPlan
protected PlanInstance plan
protected GoalInstance.GoalState state
protected SchemeInstance sch
protected java.util.Map<java.lang.String,java.lang.Object> args
protected java.util.List<OEAgent> comAgs
protected java.util.List<OEAgent> achievedAgs
public GoalInstance(Goal sg, SchemeInstance sch)
public Goal getSpec()
public SchemeInstance getScheme()
public void setInPlan(PlanInstance pi)
public void setPlanToAchieve(PlanInstance pi) throws MoiseConsistencyException
MoiseConsistencyException
public PlanInstance getPlanToAchieve()
public void setArgumentValue(java.lang.String arg, java.lang.Object value) throws MoiseException
InstanceGoal gA = sch.getGoal("a");
gA.setArgumentValue("Z", "120");
arg
- the argument identificationvalue
- the value for this argumentMoiseException
- there is not such an arg idpublic java.lang.Object getArgumentValue(java.lang.String arg)
public java.util.Map<java.lang.String,java.lang.Object> getArgumentValues()
public void setAchieved(OEAgent a) throws MoiseConsistencyException, MoiseCardinalityException
public void setImpossible(OEAgent a) throws MoiseConsistencyException
MoiseConsistencyException
public void committed(OEAgent a)
public void uncommitted(OEAgent a)
public boolean isEnabled()
public boolean isSatisfied()
public GoalInstance.GoalState getState()
public boolean isImpossible()
public boolean isCommitted()
public boolean hasComittedAgents()
public java.util.Collection<OEAgent> getCommittedAgents()
public java.util.Collection<OEAgent> getAchievedAgents()
public boolean hasSuperGoalInState(GoalInstance.GoalState s)
public static java.lang.String getXMLTag()
public org.w3c.dom.Element getAsDOM(org.w3c.dom.Document document)
public int hashCode()
hashCode
in class MoiseElement
public boolean equals(java.lang.Object o)
equals
in class MoiseElement
public java.lang.String getAsProlog()
getAsProlog
in interface ToProlog
public java.lang.String toString()
toString
in class MoiseElement