org.norther.tammi.spray.template.flow
Class StepMatrix

java.lang.Object
  extended by org.norther.tammi.spray.template.flow.StepMatrix
All Implemented Interfaces:
Serializable, Cloneable

public class StepMatrix
extends Object
implements Cloneable, Serializable

Allowed routes between template flows and their steps are defined by BitSet matrix of size (n+1)*(n+1), where n is the number of steps in a flow. Index 0 is reserved to define access to step into and out from the flow.

Author:
Ilkka Priha
See Also:
Serialized Form

Constructor Summary
StepMatrix(int count)
          Constructs a default step matrix.
StepMatrix(int count, BitSet set)
          Constructs a step matrix with routes.
StepMatrix(int count, boolean enabled)
          Constructs an enabled or disabled step matrix.
 
Method Summary
 Object clone()
          Returns a copy of this matrix.
 Object clone(int count)
          Returns a copy of this matrix with a different number of steps.
 boolean get()
          Gets all routes in this matrix.
 boolean get(int index)
          Gets the routes of the specified step.
 boolean get(int source, int target)
          Gets the route between steps.
 BitSet getBitSet()
          Gets the route set.
 int getCount()
          Gets the number of steps.
 boolean getFrom(int source)
          Gets the routes from the specified step.
 boolean getTo(int target)
          Gets the routes to the specified step.
 void reset()
          Resets default routes.
 void reset(int index)
          Resets default routes of the specified step.
 void reset(int source, int target)
          Resets the default route between steps.
 void resetFrom(int source)
          Resets default routes from the specified step.
 void resetTo(int target)
          Resets default routes to the specified step.
 void set(boolean flag)
          Sets all routes in this matrix.
 void set(int index, boolean flag)
          Sets the routes of the specified step.
 void set(int source, int target, boolean flag)
          Sets the route between steps.
 void setFrom(int source, boolean flag)
          Sets the routes from the specified step.
 void setTo(int target, boolean flag)
          Sets the routes to the specified step.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StepMatrix

public StepMatrix(int count)
Constructs a default step matrix.

Parameters:
count - the number of steps.

StepMatrix

public StepMatrix(int count,
                  boolean enabled)
Constructs an enabled or disabled step matrix.

Parameters:
count - the number of steps.
enabled - true for enabled, false for disabled.

StepMatrix

public StepMatrix(int count,
                  BitSet set)
Constructs a step matrix with routes.

Parameters:
count - the number of steps.
set - the enabled routes.
Method Detail

clone

public Object clone()
Returns a copy of this matrix.

Overrides:
clone in class Object
Returns:
a copy of this matrix.

clone

public Object clone(int count)
Returns a copy of this matrix with a different number of steps.

Parameters:
count - the number of steps.
Returns:
a modified copy of this matrix.

getCount

public int getCount()
Gets the number of steps.

Returns:
the number of steps.

getBitSet

public BitSet getBitSet()
Gets the route set.

Returns:
the route set.

get

public boolean get()
Gets all routes in this matrix.

Returns:
true if enabled, otherwise false.

set

public void set(boolean flag)
Sets all routes in this matrix.

Parameters:
flag - true if enabled, otherwise false.

get

public boolean get(int index)
Gets the routes of the specified step.

Parameters:
index - the index of the step.
Returns:
true if enabled, otherwise false.

set

public void set(int index,
                boolean flag)
Sets the routes of the specified step.

Parameters:
index - the index of the step.
flag - true if enabled, otherwise false.

getFrom

public boolean getFrom(int source)
Gets the routes from the specified step.

Parameters:
source - the index of the source step.
Returns:
true if enabled, otherwise false.

setFrom

public void setFrom(int source,
                    boolean flag)
Sets the routes from the specified step.

Parameters:
source - the index of the source step.
flag - true if enabled, otherwise false.

getTo

public boolean getTo(int target)
Gets the routes to the specified step.

Parameters:
target - the index of the target step.
Returns:
true if enabled, otherwise false.

setTo

public void setTo(int target,
                  boolean flag)
Sets the routes to the specified step.

Parameters:
target - the index of the target step.
flag - true if enabled, otherwise false.

get

public boolean get(int source,
                   int target)
Gets the route between steps.

Parameters:
source - the index of the source step.
target - the index of the target step.
Returns:
true if enabled, otherwise false.

set

public void set(int source,
                int target,
                boolean flag)
Sets the route between steps.

Parameters:
source - the index of the source step.
target - the index of the target step.
flag - true if enabled, otherwise false.

reset

public void reset()
Resets default routes.


reset

public void reset(int index)
Resets default routes of the specified step.

Parameters:
index - the index of the step.

resetFrom

public void resetFrom(int source)
Resets default routes from the specified step.

Parameters:
source - the index of the source step.

resetTo

public void resetTo(int target)
Resets default routes to the specified step.

Parameters:
target - the index of the target step.

reset

public void reset(int source,
                  int target)
Resets the default route between steps.

Parameters:
source - the index of the source step.
target - the index of the target step.


Copyright © 2004 The Norther Organization. All rights reserved.