frysk.hpd
Class AllPTSet

java.lang.Object
  extended by frysk.hpd.AllPTSet
All Implemented Interfaces:
PTSet

 class AllPTSet
extends Object
implements PTSet

AllPTSet holds all processes and their tasks and generates subsets for different types of sets.


Field Summary
private  CLI cli
           
private  ProcTaskIDManager manager
           
static int TASK_STATE_HELD
           
static int TASK_STATE_RUNNABLE
           
static int TASK_STATE_RUNNING
           
static int TASK_STATE_STOPPED
           
 
Constructor Summary
AllPTSet(CLI cli)
           
 
Method Summary
private  void addTasksFromRange(ArrayList taskSets, TreeMap proctasks, int[] range)
          Add tasks to the "tasks" ArrayList, as specified in "range", which corresponds to a.b:c.d notation
private  void addTasksFromReg(ArrayList taskSets, TreeMap proctasks, int[] reg)
          Add tasks to the "tasks" ArrayList, as specified in "reg", which corresponds to a:b.c:d notation
 boolean containsTask(int procid, int taskid)
           
 Proc getProc(int procID)
           
 ProcTasks[] getSubset(ParseTreeNode[] parseTree)
          Generate a subset of this set, based on the tree generated by set notation parser.
 ProcTasks[] getSubsetByExec(String execname)
           
 ProcTasks[] getSubsetByState(int state)
           
 Iterator getTaskData()
           
 Iterator getTasks()
          Return an iterator to a collection of all the tasks.
 void removeProc(int procId)
          Remove a proc from the list
 String toString()
           
private  int[] walkRangeTree(ParseTreeNode node)
          Walks a tree that corresponds to a.b:c.d notation.
private  int[] walkRegTree(ParseTreeNode node)
          Walks a tree that corresponds to a:b.c:d notation, where b and d are optional ranges.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TASK_STATE_RUNNING

public static final int TASK_STATE_RUNNING
See Also:
Constant Field Values

TASK_STATE_STOPPED

public static final int TASK_STATE_STOPPED
See Also:
Constant Field Values

TASK_STATE_RUNNABLE

public static final int TASK_STATE_RUNNABLE
See Also:
Constant Field Values

TASK_STATE_HELD

public static final int TASK_STATE_HELD
See Also:
Constant Field Values

manager

private final ProcTaskIDManager manager

cli

private final CLI cli
Constructor Detail

AllPTSet

public AllPTSet(CLI cli)
Method Detail

getProc

public Proc getProc(int procID)

containsTask

public boolean containsTask(int procid,
                            int taskid)
Specified by:
containsTask in interface PTSet

getTasks

public Iterator getTasks()
Return an iterator to a collection of all the tasks.

Specified by:
getTasks in interface PTSet

getTaskData

public Iterator getTaskData()
Specified by:
getTaskData in interface PTSet

removeProc

public void removeProc(int procId)
Remove a proc from the list

Specified by:
removeProc in interface PTSet

getSubset

public ProcTasks[] getSubset(ParseTreeNode[] parseTree)
Generate a subset of this set, based on the tree generated by set notation parser.

Parameters:
parseTree - tree generated by SetNotationParser, which is an array of ParseTreeNodes

getSubsetByState

public ProcTasks[] getSubsetByState(int state)

getSubsetByExec

public ProcTasks[] getSubsetByExec(String execname)

toString

public String toString()
Overrides:
toString in class Object

walkRangeTree

private int[] walkRangeTree(ParseTreeNode node)
Walks a tree that corresponds to a.b:c.d notation.

Parameters:
node - on a non-recursive call this should be a root of type ParseTreeNode.TYPE_RANGE
Returns:
array of {a,b,c,d} from notation a.b:c.d, -1 stands for a wildcard (*)

walkRegTree

private int[] walkRegTree(ParseTreeNode node)
Walks a tree that corresponds to a:b.c:d notation, where b and d are optional ranges.

Parameters:
node - on a non-recursive call this should be a root of type ParseTreeNode.TYPE_REG
Returns:
array of {a,b,c,d} from notation a:b.c:d, -1 stands for a wildcard (*)

addTasksFromRange

private void addTasksFromRange(ArrayList taskSets,
                               TreeMap proctasks,
                               int[] range)
Add tasks to the "tasks" ArrayList, as specified in "range", which corresponds to a.b:c.d notation

Parameters:
taskSets - array of arrays of tasks
proctasks - A treemap of Integer(procID) to ProcTasks
reg - an array of length 4 returned by walkRangeTree

addTasksFromReg

private void addTasksFromReg(ArrayList taskSets,
                             TreeMap proctasks,
                             int[] reg)
Add tasks to the "tasks" ArrayList, as specified in "reg", which corresponds to a:b.c:d notation

Parameters:
taskSets - array of arrays of tasks
proctasks - TreeMap of ProcTasks to put Procs and Tasks into
reg - an array of length 4 returned by walkRegTree