edu.ucdavis.rj.Ops
Class Inni

java.lang.Object
  extended by edu.ucdavis.rj.Ops.Inni

public class Inni
extends java.lang.Object

An Inni services on invocation from a specified group of InniOps. It consists of one or more possibly quantified arms; each arm specifies an operation or quantified group of operations and corresponding code to service the invocation. An Inni also allows an elseArm, which is executed if no invocation is selected for servicing.


Nested Class Summary
(package private) static class Inni.TimeNode
          /////////////////// will be sorted by time...
 
Field Summary
(package private)  java.util.ArrayList<InniArm> arms
           
(package private)  InniArmElseafter elseafterArm
           
private static OpMethod elseafterTimer
          This OpMethod is used by Inni's implementation to provide a timer for the elseafter arm.
(package private)  InniArmElse elseArm
           
 
Constructor Summary
Inni(InniArmElseafter elseafterArm, InniArm firstArm, InniArm... restArms)
          Create a new instance of an Inni.
Inni(InniArmElse elseArm, InniArm firstArm, InniArm... restArms)
          Create a new instance of an Inni.
Inni(InniArm firstArm, InniArm... restArms)
          Create a new instance of an Inni.
 
Method Summary
private  void createInni(InniArmElse elseArm, InniArmElseafter elseafterArm, InniArm firstArm, InniArm... restArms)
          Common code called from constructors to create a new instance of an Inni.
private  java.util.ArrayList<Inni.TimeNode> gatherAndSortTimes(java.util.ArrayList<InniArm> arms)
           
private  void oneInniArm(java.util.ArrayList<InniArm> arms, InniArm a, int armCount)
          Handle one abstract arm for this Inni.
 BaseArmCode.Control service()
          Service one invocation as specified by this Inni's arms by executing the codeBlock in the associated arm.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

arms

java.util.ArrayList<InniArm> arms

elseArm

InniArmElse elseArm

elseafterArm

InniArmElseafter elseafterArm

elseafterTimer

private static OpMethod elseafterTimer
This OpMethod is used by Inni's implementation to provide a timer for the elseafter arm. Note the parameters to its codeBlock. ////////////////////////////////////

Constructor Detail

Inni

public Inni(InniArmElse elseArm,
            InniArm firstArm,
            InniArm... restArms)
Create a new instance of an Inni. This is the general case (with an elseArm).

Parameters:
elseArm - The elseArm.
firstArm - The first arm.
restArms - Any other arms.

Inni

public Inni(InniArmElseafter elseafterArm,
            InniArm firstArm,
            InniArm... restArms)
Create a new instance of an Inni. This is the general case (with an elseafterArm).

Parameters:
elseafterArm - The elseafterArm.
firstArm - The first arm.
restArms - Any other arms.

Inni

public Inni(InniArm firstArm,
            InniArm... restArms)
Create a new instance of an Inni. This is the common case (without an elseArm or elseafterArm).

Parameters:
firstArm - The first arm.
restArms - Any other arms.
Method Detail

createInni

private void createInni(InniArmElse elseArm,
                        InniArmElseafter elseafterArm,
                        InniArm firstArm,
                        InniArm... restArms)
Common code called from constructors to create a new instance of an Inni.

Parameters:
elseArm - The elseArm.
elseafterArm - The elseafterArm.
firstArm - The first arm.
restArms - Any other arms.

oneInniArm

private void oneInniArm(java.util.ArrayList<InniArm> arms,
                        InniArm a,
                        int armCount)
Handle one abstract arm for this Inni.

Parameters:
arms - The list of arms to which to add this arm.
a - The arm.
armCount - The arm's number (0-based).

service

public BaseArmCode.Control service()
Service one invocation as specified by this Inni's arms by executing the codeBlock in the associated arm. If no invocation selected, delay the executing process until such an invocation arrives, unless this Inni has an elseArm, in which case execute the codeBlock in the elseArm.

Returns:
Value set within codeBlock indicating control flow to take.

gatherAndSortTimes

private java.util.ArrayList<Inni.TimeNode> gatherAndSortTimes(java.util.ArrayList<InniArm> arms)