zeus.actors
Class TaskDb

java.lang.Object
  extended byjava.util.Dictionary
      extended byjava.util.Hashtable
          extended byzeus.actors.TaskDb
All Implemented Interfaces:
java.lang.Cloneable, java.util.Map, java.io.Serializable

public class TaskDb
extends java.util.Hashtable

The Task Database is a simple storage component that holds the Task descriptions known by the owning agent. This information is used by the agent's Planner component.

The methods of this component are only likely to be of interest to developers who write code to monitor or change the abilities of agents. Change log ---------- 12-06-01 Added agentName and orgDb to facilitate intialisation from extended types.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class java.util.Hashtable
 
Field Summary
static int ACCESS
           
static int ADD
           
protected  java.lang.String agentName
           
protected static int CMAX
           
protected static int CMIN
           
protected  AgentContext context
           
static int DELETE
           
protected  boolean demo_version
           
protected  HSet[] eventMonitor
           
protected  GenSym gensym
           
static int MODIFY
           
static int NONE
           
protected  OrganisationDb orgDb
           
protected static java.util.Random rand
           
 
Fields inherited from class java.util.Hashtable
 
Constructor Summary
TaskDb()
           
TaskDb(AgentContext context)
           
 
Method Summary
 void add(Task task)
          The primary method for adding new task abilities to the Task Database
 void add(Task[] List)
           
 void add(java.util.Vector List)
           
protected  int addItem(Fact[] List, Task task)
           
protected  int addItem(Fact fact, Task task)
           
protected  int addItem(java.util.Vector List, Task task)
           
 void addTaskMonitor(TaskMonitor monitor, long event_type)
           
 void addTaskMonitor(TaskMonitor monitor, long event_type, boolean notify_previous)
          Use this if your code needs to react to changes in the Task Database
 void checkAndMapValue(java.lang.String attrName, AttributeList attrs, Fact[] produced)
          checkAndMapValue takes a value from an attribute and checks to see if it is a reference to a post condition.
protected  java.util.Vector checkPath(java.util.Vector prior, java.util.Vector path)
           
private  void debug(java.lang.String out)
           
 void del(Task task)
          The primary method for deleting task abilities from the Task Database
 void del(Task[] List)
           
 void del(java.util.Vector List)
           
protected  int deleteItem(Fact[] List, Task task)
           
protected  int deleteItem(Fact fact, Task task)
           
protected  int deleteItem(java.util.Vector List, Task task)
           
 void deleteTask(java.lang.String name)
          Deletes the task object with the given name
 java.util.Vector findAll(Fact fact)
          Retrieves the tasks that produce a fact matching the parameter
 java.util.Vector findAll(Fact[] consumed, Fact[] produced, java.util.Vector path)
          Retrieves the tasks that produce and consume the same facts as the parameters
 java.util.Vector findAll(Fact fact, java.util.Vector path)
           
 Task findOne(Fact fact)
          Randomly chooses a task able to produces a fact matching the parameter
 AgentContext getAgentContext()
          returns a reference to the agent context pointer
 Task getTask(java.lang.String name)
          Returns a duplicate of the task object with the given name
protected  boolean hasCondition(Fact[] test, Fact[] data)
           
protected  boolean hasCondition(Fact test, Fact[] data)
           
protected  void notifyMonitors(Task task, int type)
           
protected  java.util.Vector reduce(java.util.Hashtable List, Fact fact)
           
 void removeTaskMonitor(TaskMonitor monitor, long event_type)
           
 void resolveall(ArithmeticFn target, Task task, Fact[] resolvers)
           
 void resolveCostAndTime(Task task, Fact[] consumed, Fact[] produced)
          resolveCostAndTime is used to check that the cost and timing of the task in terms of the preconditions and postconditions of the task is properly resolved .
 void resolvePreconditions(Task task, Fact[] consumed, Fact[] produced)
          resolvePreconditions is used to check through all the precondition attributes in the task as they are loaded to see if there are any references to postcondition attributes, and then resolve those references so that when task chaining and execution occur the correct values will be used
protected  void sort_basic(java.util.Vector List)
           
protected  void sort(java.util.Vector List)
          Sorts a vector of tasks according to their time and cost functions
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

eventMonitor

protected HSet[] eventMonitor

MODIFY

public static final int MODIFY
See Also:
Constant Field Values

ADD

public static final int ADD
See Also:
Constant Field Values

DELETE

public static final int DELETE
See Also:
Constant Field Values

ACCESS

public static final int ACCESS
See Also:
Constant Field Values

NONE

public static final int NONE
See Also:
Constant Field Values

rand

protected static java.util.Random rand

CMIN

protected static int CMIN

CMAX

protected static int CMAX

demo_version

protected boolean demo_version

agentName

protected java.lang.String agentName

orgDb

protected OrganisationDb orgDb

context

protected AgentContext context

gensym

protected GenSym gensym
Constructor Detail

TaskDb

public TaskDb()

TaskDb

public TaskDb(AgentContext context)
Method Detail

getAgentContext

public AgentContext getAgentContext()
returns a reference to the agent context pointer


add

public void add(Task task)
The primary method for adding new task abilities to the Task Database


resolveCostAndTime

public void resolveCostAndTime(Task task,
                               Fact[] consumed,
                               Fact[] produced)
resolveCostAndTime is used to check that the cost and timing of the task in terms of the preconditions and postconditions of the task is properly resolved . Works like this: get the cost out, check to see if it matches any of the consumed (postconditions), then check to see if it matches any of the produced (preconditions) If it does, copy the values for evaluation. ISSUES -------- My main concern is that I have really foobared, and this used to be done somewhere else, but I have broken it : suggestions to me please!

Since:
1.2.1

resolveall

public void resolveall(ArithmeticFn target,
                       Task task,
                       Fact[] resolvers)

resolvePreconditions

public void resolvePreconditions(Task task,
                                 Fact[] consumed,
                                 Fact[] produced)
resolvePreconditions is used to check through all the precondition attributes in the task as they are loaded to see if there are any references to postcondition attributes, and then resolve those references so that when task chaining and execution occur the correct values will be used

Since:
1.2.1

checkAndMapValue

public void checkAndMapValue(java.lang.String attrName,
                             AttributeList attrs,
                             Fact[] produced)
checkAndMapValue takes a value from an attribute and checks to see if it is a reference to a post condition. If it is, then it will map the value of the post condition reference to the precondition: if we have a precondition x.name = ?y.name where the post condition is ?y and ?y.name is ?var123 then we should map the precondition to : x.name = ?var123 if this is made so, all will be well, and good, good, will have triumphed.

Since:
1.2.1

add

public void add(java.util.Vector List)

add

public void add(Task[] List)

addItem

protected int addItem(java.util.Vector List,
                      Task task)

addItem

protected int addItem(Fact[] List,
                      Task task)

addItem

protected int addItem(Fact fact,
                      Task task)

del

public void del(Task task)
The primary method for deleting task abilities from the Task Database


del

public void del(java.util.Vector List)

del

public void del(Task[] List)

deleteItem

protected int deleteItem(java.util.Vector List,
                         Task task)

deleteItem

protected int deleteItem(Fact[] List,
                         Task task)

deleteItem

protected int deleteItem(Fact fact,
                         Task task)

getTask

public Task getTask(java.lang.String name)
Returns a duplicate of the task object with the given name


deleteTask

public void deleteTask(java.lang.String name)
Deletes the task object with the given name


findOne

public Task findOne(Fact fact)
Randomly chooses a task able to produces a fact matching the parameter


findAll

public java.util.Vector findAll(Fact fact)
Retrieves the tasks that produce a fact matching the parameter


findAll

public java.util.Vector findAll(Fact fact,
                                java.util.Vector path)

findAll

public java.util.Vector findAll(Fact[] consumed,
                                Fact[] produced,
                                java.util.Vector path)
Retrieves the tasks that produce and consume the same facts as the parameters


hasCondition

protected boolean hasCondition(Fact[] test,
                               Fact[] data)

hasCondition

protected boolean hasCondition(Fact test,
                               Fact[] data)

checkPath

protected java.util.Vector checkPath(java.util.Vector prior,
                                     java.util.Vector path)

reduce

protected java.util.Vector reduce(java.util.Hashtable List,
                                  Fact fact)

sort

protected void sort(java.util.Vector List)
Sorts a vector of tasks according to their time and cost functions


sort_basic

protected void sort_basic(java.util.Vector List)

addTaskMonitor

public void addTaskMonitor(TaskMonitor monitor,
                           long event_type,
                           boolean notify_previous)
Use this if your code needs to react to changes in the Task Database


addTaskMonitor

public void addTaskMonitor(TaskMonitor monitor,
                           long event_type)

removeTaskMonitor

public void removeTaskMonitor(TaskMonitor monitor,
                              long event_type)

notifyMonitors

protected void notifyMonitors(Task task,
                              int type)

debug

private void debug(java.lang.String out)


Copyright © 2000-2003 BT Exact Technologies. All Rights Reserved.