edu.williams.cs.ljil.introspector
Class ItemIntrospector

java.lang.Object
  extended by edu.williams.cs.ljil.introspector.ItemIntrospector

public abstract class ItemIntrospector
extends java.lang.Object

This class allows one to ask questions about the state of an agenda item, the process instance it is a member of, and the process definition it comes from.


Field Summary
protected  laser.littlejil.AbstractStep abstractStep
          The abstract step that this agenda item represents.
protected  laser.littlejil.Step concreteStep
          The concrete step that this agenda item represents.
protected  laser.juliette.ams.AgendaItem item
          The agenda item that it answers questions for
protected  laser.juliette.ams.AgendaItem parentItem
          The parent item
protected  AbstractStepIntrospector stepIntrospector
          An introspector for the step to allow asking questions about the process definition.
 
Constructor Summary
protected ItemIntrospector(laser.juliette.ams.AgendaItem theItem)
          Constructs an introspector for an agenda item.
 
Method Summary
static ItemIntrospector createItemIntrospector(laser.juliette.ams.AgendaItem theItem)
          Constructs an introspector for an agenda item.
abstract  java.util.Collection followsChild(laser.littlejil.AbstractStep child)
           
 laser.littlejil.AbstractStep getAbstractStep()
           
 int getCardinalityPosition()
           
 laser.littlejil.Step getConcreteStep()
           
 java.util.Iterator getInputParameterNames()
           
 java.lang.Class[] getInputParamTypes()
           
 java.lang.Object[] getInputParamValues()
           
 laser.juliette.ams.AgendaItem getItem()
           
 int getMaxCardinality()
           
 int getMinCardinality()
           
 java.lang.String getName()
           
 java.util.Collection getNextSteps()
           
 java.util.Iterator getOutputParameterNames()
           
 java.lang.Class[] getOutputParamTypes()
           
 java.util.Iterator getParameterNames()
           
 java.lang.Class[] getParamTypes()
           
 java.util.Iterator getPossibleExceptions()
           
 java.util.Collection getReachableLeaves()
           
 java.util.Iterator getSiblingItems()
           
 laser.littlejil.AbstractStep getSubstep(int n)
           
 int getSubstepIndex(laser.littlejil.AbstractStep step)
           
 java.util.Iterator getSubsteps()
           
 boolean isChoice()
           
 boolean isLeaf()
           
 boolean isParallel()
           
 boolean isSequential()
           
 boolean isTry()
           
 int numInputParams()
           
 int numOutputParams()
           
 int numParams()
           
 int numSubsteps()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

item

protected laser.juliette.ams.AgendaItem item
The agenda item that it answers questions for


parentItem

protected laser.juliette.ams.AgendaItem parentItem
The parent item


stepIntrospector

protected AbstractStepIntrospector stepIntrospector
An introspector for the step to allow asking questions about the process definition.


abstractStep

protected laser.littlejil.AbstractStep abstractStep
The abstract step that this agenda item represents. This may be a Reference or a Step.


concreteStep

protected laser.littlejil.Step concreteStep
The concrete step that this agenda item represents.

Constructor Detail

ItemIntrospector

protected ItemIntrospector(laser.juliette.ams.AgendaItem theItem)
                    throws NullItemException,
                           laser.juliette.ams.AMSException
Constructs an introspector for an agenda item.

Parameters:
theItem - the agenda item that will be introspected
Throws:
NullItemException - thrown if theItem is null
laser.juliette.ams.AMSException - thrown if we can't contact the agenda management system
Method Detail

createItemIntrospector

public static ItemIntrospector createItemIntrospector(laser.juliette.ams.AgendaItem theItem)
                                               throws NullItemException,
                                                      laser.juliette.ams.AMSException
Constructs an introspector for an agenda item.

Parameters:
theItem - the agenda item that will be introspected
Throws:
NullItemException - thrown if theItem is null
laser.juliette.ams.AMSException - thrown if we can't contact the agenda management system

getItem

public laser.juliette.ams.AgendaItem getItem()
Returns:
the agenda item being introspected

getConcreteStep

public laser.littlejil.Step getConcreteStep()
Returns:
the step definition (not a reference) that corresponds to this agenda item

getAbstractStep

public laser.littlejil.AbstractStep getAbstractStep()
Returns:
the step instance that corresponds to this agenda item. This may be a Step or a Reference

isLeaf

public boolean isLeaf()
Returns:
true if the step associated with this item is a leaf step

isSequential

public boolean isSequential()
Returns:
true if the step associated with this item is a sequential step

isParallel

public boolean isParallel()
Returns:
true if the step associated with this item is a parallel step

isChoice

public boolean isChoice()
Returns:
true if the step associated with this item is a choice step

isTry

public boolean isTry()
Returns:
true if the step associated with this item is a try step

getName

public java.lang.String getName()
Returns:
the name of the step the agenda item is for

numParams

public int numParams()
Returns:
the number of parameters to the agenda item

numOutputParams

public int numOutputParams()
Returns:
the number of out and in/out parameters to the agenda item

numInputParams

public int numInputParams()
Returns:
the number of in and in/out parameters to the agenda item

getParamTypes

public java.lang.Class[] getParamTypes()
Returns:
an array of the classes of the parameters to an agenda item

getInputParamTypes

public java.lang.Class[] getInputParamTypes()
Returns:
an array of the classes of the in and in-out parameters to an agenda item

getOutputParamTypes

public java.lang.Class[] getOutputParamTypes()
Returns:
an array of the classes of the out and in-out parameters to an agenda item

getParameterNames

public java.util.Iterator getParameterNames()
Returns:
an iterator containing Strings whose values are the names of the parameters

getInputParameterNames

public java.util.Iterator getInputParameterNames()
Returns:
an iterator containing Strings whose values are the names of the input parameters

getOutputParameterNames

public java.util.Iterator getOutputParameterNames()
Returns:
an iterator containing Strings whose values are the names of the output parameters

getInputParamValues

public java.lang.Object[] getInputParamValues()
                                       throws laser.juliette.ams.AMSException
Returns:
an array of the values of the in and in-out parameters to an agenda item
Throws:
laser.juliette.ams.AMSException - if communication with the agenda is lost

getPossibleExceptions

public java.util.Iterator getPossibleExceptions()
Returns:
the exceptions that the agenda item may throw

getReachableLeaves

public java.util.Collection getReachableLeaves()
Returns:
the names of all the leaf steps that are reachable as first steps from here

numSubsteps

public int numSubsteps()
Returns:
the number of substeps a step has

getSubstepIndex

public int getSubstepIndex(laser.littlejil.AbstractStep step)
                    throws NoSuchSubstepException
Parameters:
substep - the substep to look for
Returns:
the index of the position of a given step with its parent
Throws:
NoSuchSubstepException - thrown if the substep is not found

getSubstep

public laser.littlejil.AbstractStep getSubstep(int n)
                                        throws NoSuchSubstepException
Parameters:
n - the index of the substep to return. The first substep has index 0
Returns:
the nth substep
Throws:
NoSuchSubstepException - thrown if the step is a leaf or if n is not a valid substep index for this step

getSubsteps

public java.util.Iterator getSubsteps()
Returns:
an iterator over the substeps of a step. The type of the elements in the iterator is AbstractStep. Returns an empty iterator for leaf steps and for non-leafs with no children

getNextSteps

public java.util.Collection getNextSteps()
                                  throws laser.juliette.ams.AMSException
Returns:
all the steps that may immediately follow this step
Throws:
laser.juliette.ams.AMSException - The agent lost contact with its agenda

followsChild

public abstract java.util.Collection followsChild(laser.littlejil.AbstractStep child)
                                           throws laser.juliette.ams.AMSException
Parameters:
child - the child of this item that we want to find followers of
Returns:
all the steps that may immediately follow the given child of this item if this child is opted out
Throws:
laser.juliette.ams.AMSException - thrown if cannot communicate with the agenda management system

getMinCardinality

public int getMinCardinality()
Returns:
the minimum cardinality for the step this agenda item represents

getMaxCardinality

public int getMaxCardinality()
Returns:
the maximum cardinality for the step this agenda item represents

getCardinalityPosition

public int getCardinalityPosition()
                           throws laser.juliette.ams.AMSException
Returns:
which instantiation of the step this is corresponding to a single binding to parent
Throws:
laser.juliette.ams.AMSException - thrown if we cannot contact the agenda management system

getSiblingItems

public java.util.Iterator getSiblingItems()
                                   throws laser.juliette.ams.AMSException
Throws:
laser.juliette.ams.AMSException