clarion.system
Class GoalStructure

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.AbstractSequentialList<E>
              extended by java.util.LinkedList<T>
                  extended by clarion.system.AbstractIntermediateModule<Goal>
                      extended by clarion.system.GoalStructure
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<Goal>, java.util.Collection<Goal>, java.util.List<Goal>, java.util.Queue<Goal>

public class GoalStructure
extends AbstractIntermediateModule<Goal>

This class implements the goal structure within CLARION. It extends the AbstractIntermediateModule class. Conceptually, this system exists on the top level of the MS. However, implementationally it is logical to specify it as an intermediate module since it is used by several subsystems. Therefore, in the CLARION Library, the goal structure is contained within the CLARION class.

Usage:

The goal structure's main function is to act as a container for the goals within CLARION. In addition to containing methods for adding and removing items from the goal list, it also keeps track of all of the possible goals that can be set and has a method for getting the current goal.

It is EXTREMELY important that you only manipulate the goal structure using the add and remove methods that have been overridden by this class.

Currently this is simply a container for the goal list.

This class contains both global (static) and local constants. The default is to use the local constants. If you want to change any of the global constants, you need to do so before any instances of this class are initialized.

Version:
6.0.4
Author:
Nick Wilson
See Also:
Serialized Form

Field Summary
static int GLOBAL_GOAL_LIST_CAPACITY
          The number of slots in the goal list.
 int GOAL_LIST_CAPACITY
          The number of slots in the goal list.
private  GoalCollection PossibleGoals
          All of the possible Goals that can be added to the goal structure.
private static long serialVersionUID
           
 
Fields inherited from class clarion.system.AbstractIntermediateModule
InputSpace
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
GoalStructure(CLARION Agent)
          Initializes the goal structure.
 
Method Summary
 boolean add(Goal G)
          Adds a goal to the goal list.
 boolean addAll(java.util.Collection<? extends Goal> G)
          Adds a collection of goals to the goal structure.
 boolean addPossibleGoal(Goal G)
          Adds a goal to the list of possible goals.
 boolean addPossibleGoals(java.util.Collection<Goal> Goals)
          Adds a collection of goals to the list of possible goals.
protected  void attachSelfToAgent(CLARION Agent)
          Attaches the goal structure to the specified CLARION agent.
 Goal getCurrentGoal()
          Gets the current goal.
 int getNumPossibleGoals()
          Gets the number of possible goals.
 java.util.Collection<Goal> getPossibleGoals()
          Gets a collection of the possible goals.
 Goal remove(int Index)
          Removes a goal from the goal list.
 boolean remove(java.lang.Object G)
          Removes the goal object from the goal list.
 
Methods inherited from class clarion.system.AbstractIntermediateModule
updateInputSpace
 
Methods inherited from class java.util.LinkedList
add, addAll, addFirst, addLast, clear, clone, contains, element, get, getFirst, getLast, indexOf, lastIndexOf, listIterator, offer, peek, poll, remove, removeFirst, removeLast, set, size, toArray, toArray
 
Methods inherited from class java.util.AbstractSequentialList
iterator
 
Methods inherited from class java.util.AbstractList
equals, hashCode, listIterator, removeRange, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, isEmpty, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, isEmpty, iterator, listIterator, removeAll, retainAll, subList
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

GLOBAL_GOAL_LIST_CAPACITY

public static int GLOBAL_GOAL_LIST_CAPACITY
The number of slots in the goal list.


GOAL_LIST_CAPACITY

public int GOAL_LIST_CAPACITY
The number of slots in the goal list.


PossibleGoals

private GoalCollection PossibleGoals
All of the possible Goals that can be added to the goal structure.

Constructor Detail

GoalStructure

public GoalStructure(CLARION Agent)
Initializes the goal structure. During initialization this instance of the goal structure will attach itself to the CLARION agent you specify.

Parameters:
Agent - The agent to which the goal structure is being attached.
Method Detail

getCurrentGoal

public Goal getCurrentGoal()
Gets the current goal. The current goal is the goal in the list with the highest BLA. If no goals are in the goal list, this method returns null.

Returns:
The current goal. Null if no goals are in the list.

add

public boolean add(Goal G)
            throws FullContainerException,
                   java.lang.IllegalArgumentException
Adds a goal to the goal list. If you are trying to add a goal to the goal structure that has dimension-value pairs that do not exist in CLARION's internal input space or the goal structure is full, this method will throw an exception.

If you want to add a new goal to the list of possible goals in the goal structure, call the addPossibleGoal method.

Specified by:
add in interface java.util.Collection<Goal>
Specified by:
add in interface java.util.List<Goal>
Overrides:
add in class java.util.LinkedList<Goal>
Parameters:
G - The goal to add.
Returns:
True only if the goal was successfully added.
Throws:
FullContainerException - If the goal structure is full.
java.lang.IllegalArgumentException - If the input space does not contain all of the dimension-value pairs specified in the goal.

addAll

public boolean addAll(java.util.Collection<? extends Goal> G)
Adds a collection of goals to the goal structure.

Specified by:
addAll in interface java.util.Collection<Goal>
Specified by:
addAll in interface java.util.List<Goal>
Overrides:
addAll in class java.util.LinkedList<Goal>
Parameters:
G - The goals to add.
Returns:
True only if the goals were successfully added.

remove

public Goal remove(int Index)
Removes a goal from the goal list.

Specified by:
remove in interface java.util.List<Goal>
Overrides:
remove in class java.util.LinkedList<Goal>
Parameters:
Index - The index of the goal to remove.
Returns:
The removed goal.

remove

public boolean remove(java.lang.Object G)
Removes the goal object from the goal list.

Specified by:
remove in interface java.util.Collection<Goal>
Specified by:
remove in interface java.util.List<Goal>
Overrides:
remove in class java.util.LinkedList<Goal>
Parameters:
G - The goal to remove.
Returns:
True if the goal was successfully removed.

getNumPossibleGoals

public int getNumPossibleGoals()
Gets the number of possible goals.

Returns:
The number of possible goals.

getPossibleGoals

public java.util.Collection<Goal> getPossibleGoals()
Gets a collection of the possible goals.

Returns:
An unmodifiable collection of goals.

addPossibleGoal

public boolean addPossibleGoal(Goal G)
Adds a goal to the list of possible goals. If the goal is already in the list of possible goals, it will not be added.

Remember that the input layer of an implicit module or rule in the ACS must contain nodes for all dimension-value pairs contained within any of the possible goals you wish to have as input into the network or rule condition.

Parameters:
G - The possible goal to add.
Returns:
True if the goal was successfully added.

addPossibleGoals

public boolean addPossibleGoals(java.util.Collection<Goal> Goals)
Adds a collection of goals to the list of possible goals. If a goal from the collection is already in the list of possible goals, it will not be added.

Remember that the input layer of an implicit module or rule in the ACS must contain nodes for all dimension-value pairs contained within any of the possible goals you wish to have as input into the network or rule condition.

Parameters:
Goals - The collection of possible goals to add.
Returns:
True if any of the goals were successfully added.

attachSelfToAgent

protected void attachSelfToAgent(CLARION Agent)
Attaches the goal structure to the specified CLARION agent.

Specified by:
attachSelfToAgent in class AbstractIntermediateModule<Goal>
Parameters:
Agent - The agent to wish this goal structure will be attached.