demo.helicopter
Class GoalDefensive

java.lang.Object
  extended bydemo.helicopter.GoalDefensive
All Implemented Interfaces:
Goal

public class GoalDefensive
extends java.lang.Object
implements Goal

GoalDefensive implements the Goal interface in the RELATE architecture. This goal directs the Agent defend his own flag no matter where that position might be.

Since:
JDK1.2
Version:
1.0, 17 Aug 00
Author:
Michael R. Dickson, Kimberly A. Roddy

Constructor Summary
GoalDefensive()
          Constructor for the Coordinate goal
 
Method Summary
 void addRule(Rule pRule)
          Adds the passed in Rule to the ruleList Vector.
 void assignCredit(SensedEnvironment pPE)
          Assigns credit to itself (i.e.
 Rule getActiveRule()
          Gets the Goal active rule
 java.lang.String getGoalName()
          Gets the Goal name
 int getGoalType()
          Gets the Goal type
 Rule getPastActiveRule()
          Gets the Goal past active rule
 java.util.Vector getRuleList()
          Returns the ruleList Vector.
 boolean removeRule(Rule pRule)
          Interface required group
 java.lang.Object runActiveRule(SensedEnvironment pPE)
          Passes the PerceivedEnvironment to the activeRule in its calculate() method.
 void setActiveRule(Rule pRule)
          Sets the ActiveRule, used for goal attainment.
 void setGoalName(java.lang.String pGoalName)
           
 void setGoalType(int pType)
          Sets the Goals type, the developer should designate specific goal types to be used in the RELATE architecture.
 void setPastActiveRule(Rule pRule)
          Setter and getter group
 java.lang.String toString()
          Returns a formated description of this Goal suitable for printing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GoalDefensive

public GoalDefensive()
Constructor for the Coordinate goal

Method Detail

addRule

public void addRule(Rule pRule)
Adds the passed in Rule to the ruleList Vector.

Specified by:
addRule in interface Goal

removeRule

public boolean removeRule(Rule pRule)
Interface required group

Specified by:
removeRule in interface Goal
Parameters:
pRule - The Rule that is to be removed
Returns:
The success of the removal operation:
  • true - The Rule was successfully removed
  • false - The Rule did not exist in the Goal's ruleList

  • getRuleList

    public java.util.Vector getRuleList()
    Description copied from interface: Goal
    Returns the ruleList Vector.

    Specified by:
    getRuleList in interface Goal
    Returns:
    ruleList

    assignCredit

    public void assignCredit(SensedEnvironment pPE)
    Description copied from interface: Goal
    Assigns credit to itself (i.e. updates goal attainment weight )and the lastRule by receiving the new PerceivedEnvironment to the Goal and letting the Goal determine the credit assignment to itself (goal attainment) and all of the Rules associated with that Goal, both active and inactive. Assigns the Rule with the highest weight to the activeRule.

    Specified by:
    assignCredit in interface Goal
    Parameters:
    pPE - The agent's perceived environment.

    runActiveRule

    public java.lang.Object runActiveRule(SensedEnvironment pPE)
    Description copied from interface: Goal
    Passes the PerceivedEnvironment to the activeRule in its calculate() method.

    Specified by:
    runActiveRule in interface Goal
    Returns:
    an Object associated with the active Rules calculation

    setPastActiveRule

    public void setPastActiveRule(Rule pRule)
    Setter and getter group

    Specified by:
    setPastActiveRule in interface Goal
    Parameters:
    pRule - The agent's past active rule.

    setGoalType

    public void setGoalType(int pType)
    Description copied from interface: Goal
    Sets the Goals type, the developer should designate specific goal types to be used in the RELATE architecture.

    Specified by:
    setGoalType in interface Goal
    Parameters:
    pType - Integer representing the goal type.

    setActiveRule

    public void setActiveRule(Rule pRule)
    Description copied from interface: Goal
    Sets the ActiveRule, used for goal attainment.

    Specified by:
    setActiveRule in interface Goal
    Parameters:
    pRule - The agent's active rule.

    getGoalType

    public int getGoalType()
    Description copied from interface: Goal
    Gets the Goal type

    Specified by:
    getGoalType in interface Goal
    Returns:
    an Int representing the goal type

    getGoalName

    public java.lang.String getGoalName()
    Description copied from interface: Goal
    Gets the Goal name

    Specified by:
    getGoalName in interface Goal
    Returns:
    a String of the goals name (should be the goal class name)

    setGoalName

    public void setGoalName(java.lang.String pGoalName)

    getActiveRule

    public Rule getActiveRule()
    Description copied from interface: Goal
    Gets the Goal active rule

    Specified by:
    getActiveRule in interface Goal
    Returns:
    the Goals active rule

    getPastActiveRule

    public Rule getPastActiveRule()
    Description copied from interface: Goal
    Gets the Goal past active rule

    Specified by:
    getPastActiveRule in interface Goal
    Returns:
    the Goals oast active rule

    toString

    public java.lang.String toString()
    Description copied from interface: Goal
    Returns a formated description of this Goal suitable for printing

    Specified by:
    toString in interface Goal