eaLib API Docs
Last Modified : January 7 2002

mss.ea.al
Class AbstractFork

java.lang.Object
  |
  +--mss.ea.al.FlowElement
        |
        +--mss.ea.al.AbstractFork
All Implemented Interfaces:
MessageRecipient, java.lang.Runnable
Direct Known Subclasses:
StreamMultiCaster, StreamRouter

public abstract class AbstractFork
extends FlowElement

Abstract base class for a fork element. A fork is a flow element which has exactly one predecessor and an arbitrary number of successors.

Since:
0.2
Version:
$Revision: 1.4 $ $Date: 2001/11/27 14:48:06 $
Author:
Andreas Rummler

Field Summary
protected  FlowElement predecessor
          Predecessor of this fork.
protected  java.util.ArrayList successorList
          Successor list of this fork.
 
Fields inherited from class mss.ea.al.FlowElement
broker, messageChannel, name, receivedMessage, sync
 
Constructor Summary
AbstractFork(MessageBroker broker, java.lang.String name)
          Constructor with message broker.
AbstractFork(java.lang.String name)
          Constructor.
 
Method Summary
 FlowElement getPredecessor(int index)
          Gets the predecessor of this fork.
 int getPredecessorNumber()
          Gets the number of possible predecessors.
 FlowElement getSuccessor(int index)
          Gets a successor of this fork.
 int getSuccessorNumber()
          Gets the number of current successors.
 boolean hasPredecessor()
          Checks if this fork has a predecessor.
 boolean hasSuccessor()
          Checks if this fork has at least one successor.
 void setPredecessor(FlowElement predecessor, int index)
          Sets a new predecessor.
 void setSuccessor(FlowElement successor, int index)
          Sets a new successor.
 
Methods inherited from class mss.ea.al.FlowElement
acquireChannel, react, register, run, setBroker, setChannel, setSync, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

predecessor

protected FlowElement predecessor
Predecessor of this fork.

successorList

protected java.util.ArrayList successorList
Successor list of this fork.
Constructor Detail

AbstractFork

public AbstractFork(java.lang.String name)
Constructor.
Parameters:
name - name of this fork

AbstractFork

public AbstractFork(MessageBroker broker,
                    java.lang.String name)
Constructor with message broker.
Parameters:
broker - message broker
name - name of this fork
Method Detail

hasPredecessor

public boolean hasPredecessor()
Checks if this fork has a predecessor.
Overrides:
hasPredecessor in class FlowElement
Returns:
result of the check

hasSuccessor

public boolean hasSuccessor()
Checks if this fork has at least one successor.
Overrides:
hasSuccessor in class FlowElement
Returns:
result of the check

getPredecessor

public FlowElement getPredecessor(int index)
Gets the predecessor of this fork.
Overrides:
getPredecessor in class FlowElement
Parameters:
index - does not matter
Returns:
predecessor

getSuccessor

public FlowElement getSuccessor(int index)
Gets a successor of this fork. This method returns null if an invalid index is given or if the given slot does not contain a flow element.
Overrides:
getSuccessor in class FlowElement
Parameters:
index - index of the successor
Returns:
successor element or null

setPredecessor

public void setPredecessor(FlowElement predecessor,
                           int index)
Sets a new predecessor.
Overrides:
setPredecessor in class FlowElement
Parameters:
predecessor - new predecessor
index - does not matter

setSuccessor

public void setSuccessor(FlowElement successor,
                         int index)
Sets a new successor. In case of an index < 0 this method does nothing. In case that the given index is bigger than the current length of the successor list, the list is resized to insert the given element at the given index. The positions between are filled with null elements.
Overrides:
setSuccessor in class FlowElement
Parameters:
successor - new successor
index - index of the successor

getPredecessorNumber

public int getPredecessorNumber()
Gets the number of possible predecessors.
Overrides:
getPredecessorNumber in class FlowElement
Returns:
always 1

getSuccessorNumber

public int getSuccessorNumber()
Gets the number of current successors.
Overrides:
getSuccessorNumber in class FlowElement
Returns:
number of successors

eaLib API Docs
Last Modified : January 7 2002

Copyright © 2000-2001 Technical University of Ilmenau, Department ESS