moise.os.fs
Class Plan

Package class diagram package Plan
java.lang.Object
  extended by moise.common.MoiseElement
      extended by moise.os.fs.Plan
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable, Identifiable, ToProlog, ToXML

public class Plan
extends MoiseElement
implements ToXML, ToProlog

Represents a Plan (one operator, and success rate, and a set of goals).

See Also:
Serialized Form

Nested Class Summary
static class Plan.PlanOpType
           
 
Field Summary
protected  Plan.PlanOpType op
           
protected  Scheme sch
           
protected  java.util.List<Goal> subGoals
           
protected  double successRate
           
protected  Goal target
           
 
Fields inherited from class moise.common.MoiseElement
debug
 
Constructor Summary
Plan(Plan.PlanOpType op, Scheme sch, java.lang.String targetGoalId)
           
Plan(Scheme sch)
           
 
Method Summary
 void addSubGoal(java.lang.String goalId)
           
 Goal containsSubGoals(java.lang.String goalId)
          Looks into the subgoals of the plan to find out a Goal like goalId
 org.w3c.dom.Element getAsDOM(org.w3c.dom.Document document)
           
 java.lang.String getAsProlog()
          returns a string representing the plan in Prolog syntax, format: plan(operator,list of goals)
 Plan.PlanOpType getOp()
           
 Goal getPreviousSubGoals(java.lang.String goalId)
          Looks into the subgoals of the plan to find out the previous Goal of goalId.
 java.util.List<Goal> getSubGoals()
           
 double getSuccessRate()
           
 Goal getTargetGoal()
           
static java.lang.String getXMLTag()
           
 void setFromDOM(org.w3c.dom.Element ele, Goal targetGoal)
           
 void setOp(Plan.PlanOpType op)
           
 void setSuccessRate(double d)
           
 java.lang.String toString()
           
 
Methods 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
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

subGoals

protected java.util.List<Goal> subGoals

op

protected Plan.PlanOpType op

successRate

protected double successRate

target

protected Goal target

sch

protected Scheme sch
Constructor Detail

Plan

public Plan(Scheme sch)

Plan

public Plan(Plan.PlanOpType op,
            Scheme sch,
            java.lang.String targetGoalId)
     throws MoiseConsistencyException
Throws:
MoiseConsistencyException
Method Detail

setOp

public void setOp(Plan.PlanOpType op)
           throws MoiseConsistencyException
Throws:
MoiseConsistencyException

getOp

public Plan.PlanOpType getOp()

getTargetGoal

public Goal getTargetGoal()

addSubGoal

public void addSubGoal(java.lang.String goalId)
                throws MoiseConsistencyException
Throws:
MoiseConsistencyException

getSubGoals

public java.util.List<Goal> getSubGoals()

containsSubGoals

public Goal containsSubGoals(java.lang.String goalId)
Looks into the subgoals of the plan to find out a Goal like goalId


getPreviousSubGoals

public Goal getPreviousSubGoals(java.lang.String goalId)
Looks into the subgoals of the plan to find out the previous Goal of goalId. E.g: for the plan "p = g1, g2, g3", the g2's previous goal is g1. Returns null either if the goal does no exist or has no previous goal.


setSuccessRate

public void setSuccessRate(double d)

getSuccessRate

public double getSuccessRate()

toString

public java.lang.String toString()
Overrides:
toString in class MoiseElement

getAsProlog

public java.lang.String getAsProlog()
returns a string representing the plan in Prolog syntax, format: plan(operator,list of goals)

Specified by:
getAsProlog in interface ToProlog

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

setFromDOM

public void setFromDOM(org.w3c.dom.Element ele,
                       Goal targetGoal)
                throws MoiseException
Throws:
MoiseException