|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectJSHOP2.CompileTimeObject
JSHOP2.TaskList
public class TaskList
Each task list, both at compile time and at run time, is an instance of this class.
Field Summary | |
---|---|
static TaskList |
empty
This variable represents an empty task list. |
private boolean |
ordered
Whether or not this is an ordered task list. |
TaskList[] |
subtasks
In case this task list is not-atomic, this array represents it. |
private TaskAtom |
task
In case this task list is atomic, this variable represents it. |
Fields inherited from class JSHOP2.CompileTimeObject |
---|
endl |
Constructor Summary | |
---|---|
private |
TaskList()
To initialize this task list as an empty one (i.e., an ordered non-atomic task list of length 0). |
|
TaskList(int size,
boolean orderedIn)
To initialize this task list as a non-atomic one. |
|
TaskList(TaskAtom taskIn)
To initialize this task list as an atomic one. |
Method Summary | |
---|---|
TaskList |
bind(Term[] binding)
To bind a task list to a given binding. |
TaskList |
clone()
This clone function was added so that TaskLists can be copied and passed to JSHOP2GUI. |
static TaskList |
createTaskList(java.util.Vector<TaskList> subtasksIn,
boolean orderedIn)
To create a non-atomic task list. |
void |
getChildren(java.util.ArrayList<java.lang.String> childrenList)
Returns an ArrayList of strings that represent the children of this compound task. |
java.util.LinkedList<TaskList> |
getFirst()
To return a LinkedList of the task atoms we have the option
to achieve right now. |
private boolean |
getFirstHelper(java.util.LinkedList<TaskList> res)
The helper function to calculate a LinkedList of the task
atoms we have the option to achieve right now. |
java.lang.String |
getInitCode(java.lang.String what)
This function produces Java code used to create this task list either as an atomic task list or recursively, as a list of other task lists. |
TaskList[] |
getSubtasks()
Returns the task list's subtasks |
TaskAtom |
getTask()
To return the task atom associated with this task list. |
boolean |
isEmpty()
Whether or not this task list is, or has become as result of task decomposition, an empty one. |
boolean |
isOrdered()
Returns whether or not this is an ordered task list <Added 5/14/06> |
void |
print()
This function is used to print this task list. |
void |
replace(TaskList tasksIn)
This function replaces (i.e., decomposes) a given task atom with a task list. |
void |
setVarCount(int varCountIn)
This function sets the number of variables for this task list. |
java.lang.String |
toCode()
This function produces Java code to create this task list. |
java.lang.String |
toString()
This function returns a printable String representation of
this task list. |
void |
undo()
This function undoes the decomposition of a task atom to a task list in case of a backtrack over the decision to decompose the task. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static TaskList empty
private boolean ordered
public TaskList[] subtasks
null
.
private TaskAtom task
null
.
Constructor Detail |
---|
private TaskList()
TaskList.empty
should be used to save memory.
public TaskList(TaskAtom taskIn)
taskIn
- the task atom this task list will represent.public TaskList(int size, boolean orderedIn)
size
- the number of task lists in the task list this object represents.orderedIn
- whether or not this task list is ordered.Method Detail |
---|
public TaskList bind(Term[] binding)
binding
- the given binding
public static TaskList createTaskList(java.util.Vector<TaskList> subtasksIn, boolean orderedIn)
TaskList.empty
if the required task list is of length 0 rather than creating a new empty
task list. Other than that, this function acts like a constructor.
subtasksIn
- a Vector
of subtasks the output task list will
represent.orderedIn
- whether or not the output task list should be ordered.
public java.util.LinkedList<TaskList> getFirst()
LinkedList
of the task atoms we have the option
to achieve right now. This list might have more than one member because
of the existence of unordered task lists.
LinkedList
of the task atoms we have the option to
achieve right now.private boolean getFirstHelper(java.util.LinkedList<TaskList> res)
LinkedList
of the task
atoms we have the option to achieve right now.
res
- this LinkedList
stores the task atoms we have
incrementally calculated so far.
true
if there can be no more task atoms we have the
option to achieve next because we have encountered an immediate
task atom, false
otherwise. This return value is a
sign for this function to stop calling itself recursively for
more options in case an immediate task atom has been encountered.public java.lang.String getInitCode(java.lang.String what)
what
- the String
name of the task list created by this
piece of code.
String
.public TaskAtom getTask()
null
otherwise.public boolean isEmpty()
true
if this task list is equivalent to an empty
task list, false
otherwise.public void print()
public void replace(TaskList tasksIn)
tasksIn
- the decomposition to replace the task atom.public void setVarCount(int varCountIn)
varCountIn
- the number of variables for this task list.public java.lang.String toCode()
toCode
in class CompileTimeObject
String
.public java.lang.String toString()
String
representation of
this task list.
toString
in class java.lang.Object
String
representation.public void undo()
public TaskList clone()
clone
in class java.lang.Object
public boolean isOrdered()
public TaskList[] getSubtasks()
public void getChildren(java.util.ArrayList<java.lang.String> childrenList)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |