Package moise.oe
Class GoalInstance
java.lang.Object
moise.common.MoiseElement
moise.oe.GoalInstance
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable,Identifiable,ToProlog,ToXML
public class GoalInstance extends MoiseElement implements ToXML, ToProlog
Represents an instance goal (in an instance scheme)
- Author:
- Jomi Fred Hubner
- See Also:
- Serialized Form
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGoalInstance.GoalState -
Field Summary
Fields Modifier and Type Field Description protected java.util.List<OEAgent>achievedAgsprotected java.util.Map<java.lang.String,java.lang.Object>argsprotected java.util.List<OEAgent>comAgsprotected PlanInstanceinPlanprotected PlanInstanceplanprotected SchemeInstanceschprivate static longserialVersionUIDprotected Goalspecprotected GoalInstance.GoalStatestateFields inherited from class moise.common.MoiseElement
debug -
Constructor Summary
Constructors Constructor Description GoalInstance(Goal sg, SchemeInstance sch) -
Method Summary
Modifier and Type Method Description private booleancheckEnabled()the goal is enabled in the scheme state, i.e., its pre-condition goals are satisfied.voidcommitted(OEAgent a)adds the agent a in the set of agents committed to this goalbooleanequals(java.lang.Object o)java.util.Collection<OEAgent>getAchievedAgents()java.lang.ObjectgetArgumentValue(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.ElementgetAsDOM(org.w3c.dom.Document document)java.lang.StringgetAsProlog()java.util.Collection<OEAgent>getCommittedAgents()PlanInstancegetPlanToAchieve()SchemeInstancegetScheme()GoalgetSpec()GoalInstance.GoalStategetState()static java.lang.StringgetXMLTag()booleanhasComittedAgents()inthashCode()booleanhasSuperGoalInState(GoalInstance.GoalState s)booleanisCommitted()booleanisEnabled()returns true if this goal is not satisfied yet, the scheme is well formed super goal is not satisfied, super goal is not impossible,booleanisImpossible()booleanisSatisfied()a goal is achieved if enough committed agents have set it as satisfiedvoidsetAchieved(OEAgent a)sets that this goal is achieved by the agent a.voidsetArgumentValue(java.lang.String arg, java.lang.Object value)set an argument's value for this instance goalvoidsetImpossible(OEAgent a)sets this goal as impossible to be achieved.voidsetInPlan(PlanInstance pi)voidsetPlanToAchieve(PlanInstance pi)set the plan that achieves this goalprivate voidsetSuperAchieved()private voidsetSuperImpossible()java.lang.StringtoString()voiduncommitted(OEAgent a)removes the agent a in the set of agents committed to this goalMethods inherited from class moise.common.MoiseElement
compareTo, getBoolProperty, getBoolProperty, getCreationDate, getFullId, getId, getId, getOwner, getPrefix, getPrefix, getProperties, getPropertiesAsDOM, getPropertiesAsProlog, getProperty, getStrProperty, setId, setOwner, setPrefix, setPropertiesFromDOM, setPropertyMethods 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
-
spec
-
inPlan
-
plan
-
state
-
sch
-
args
protected java.util.Map<java.lang.String,java.lang.Object> args -
comAgs
-
achievedAgs
-
-
Constructor Details
-
GoalInstance
-
-
Method Details
-
getSpec
-
getScheme
-
setInPlan
-
setPlanToAchieve
set the plan that achieves this goal- Throws:
MoiseConsistencyException
-
getPlanToAchieve
-
setArgumentValue
set an argument's value for this instance goal Example:InstanceGoal gA = sch.getGoal("a"); gA.setArgumentValue("Z", "120");- Parameters:
arg- the argument identificationvalue- the value for this argument- Throws:
MoiseException- there is not such an arg id
-
getArgumentValue
public java.lang.Object getArgumentValue(java.lang.String arg) -
getArgumentValues
public java.util.Map<java.lang.String,java.lang.Object> getArgumentValues()returns all this goal arguments (key=argId, value=Object) -
setAchieved
sets that this goal is achieved by the agent a. only committed agents can achieve the goal. If all agents committed to the goal set it as achieved, the goal is considered as satisfied. if this goal is achieved and belongs to a plan without committed agents, check if this super goal was also achieved -
setSuperAchieved
private void setSuperAchieved() -
setImpossible
sets this goal as impossible to be achieved. if this goal belongs to a plan without committed agents, check if this super goal was also impossible- Throws:
MoiseConsistencyException
-
setSuperImpossible
private void setSuperImpossible() -
committed
adds the agent a in the set of agents committed to this goal -
uncommitted
removes the agent a in the set of agents committed to this goal -
isEnabled
public 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, -
checkEnabled
private boolean checkEnabled()the goal is enabled in the scheme state, i.e., its pre-condition goals are satisfied. -
isSatisfied
public boolean isSatisfied()a goal is achieved if enough committed agents have set it as satisfied -
getState
-
isImpossible
public boolean isImpossible() -
isCommitted
public boolean isCommitted() -
hasComittedAgents
public boolean hasComittedAgents() -
getCommittedAgents
-
getAchievedAgents
-
hasSuperGoalInState
-
getXMLTag
public static java.lang.String getXMLTag() -
getAsDOM
public org.w3c.dom.Element getAsDOM(org.w3c.dom.Document document) -
hashCode
public int hashCode()- Overrides:
hashCodein classMoiseElement
-
equals
public boolean equals(java.lang.Object o)- Overrides:
equalsin classMoiseElement
-
getAsProlog
public java.lang.String getAsProlog()- Specified by:
getAsPrologin interfaceToProlog
-
toString
public java.lang.String toString()- Overrides:
toStringin classMoiseElement
-