eaLib API Docs
Last Modified : January 7 2002

mss.ea.al
Class FlowElement

java.lang.Object
  |
  +--mss.ea.al.FlowElement
All Implemented Interfaces:
MessageRecipient, java.lang.Runnable
Direct Known Subclasses:
AbstractConduit, AbstractConnector, AbstractFork, AbstractMerger, AbstractSink, AbstractSource

public abstract class FlowElement
extends java.lang.Object
implements java.lang.Runnable, MessageRecipient

Abstract base class for a flow element used in algorithms.

Since:
0.2
Version:
$Revision: 1.3 $ $Date: 2001/11/13 09:58:50 $
Author:
Andreas Rummler

Field Summary
protected  MessageBroker broker
          Message broker for receiving messages.
protected  MessageChannel messageChannel
          Message channel to send and receive messages through.
protected  java.lang.String name
          Name of the flow element.
protected  Message receivedMessage
          The message that has been received from the channel.
 Sync sync
          Synchronization object.
 
Constructor Summary
FlowElement(MessageBroker broker, java.lang.String name)
          Constructor with broker.
FlowElement(java.lang.String name)
          Constructor.
 
Method Summary
 void acquireChannel(java.lang.Object sender)
          Wakes up this flow element for listening at the message channel.
abstract  FlowElement getPredecessor(int index)
          Gets the predecessor from a particular slot.
abstract  int getPredecessorNumber()
          Gets the number of predecessors of this element.
abstract  FlowElement getSuccessor(int index)
          Gets the successor from a particular slot.
abstract  int getSuccessorNumber()
          Gets the number of successors of this element.
abstract  boolean hasPredecessor()
          Checks if this element has a predecessor.
abstract  boolean hasSuccessor()
          Checks if this element has a successor.
protected abstract  void react()
          Abstract method for reacting on an incoming message.
 void register(MessageBroker broker)
          Registers this flow element at a message broker.
 void run()
          Run method.
 void setBroker(MessageBroker broker)
          Sets a new message broker.
 void setChannel(MessageChannel channel)
          Sets a new message channel.
abstract  void setPredecessor(FlowElement predecessor, int index)
          Sets a new predecessor to a slot.
abstract  void setSuccessor(FlowElement successor, int index)
          Sets a new successor to a slot.
 void setSync(Sync sync)
          Sets a new sychronization object.
 java.lang.String toString()
          Returns the name of this flow element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

sync

public Sync sync
Synchronization object.

broker

protected MessageBroker broker
Message broker for receiving messages.

receivedMessage

protected Message receivedMessage
The message that has been received from the channel.

messageChannel

protected MessageChannel messageChannel
Message channel to send and receive messages through.

name

protected java.lang.String name
Name of the flow element.
Constructor Detail

FlowElement

public FlowElement(java.lang.String name)
Constructor.
Parameters:
name - name of the flow element

FlowElement

public FlowElement(MessageBroker broker,
                   java.lang.String name)
Constructor with broker.
Parameters:
broker - message broker
name - name of the flow element
Method Detail

hasPredecessor

public abstract boolean hasPredecessor()
Checks if this element has a predecessor.
Returns:
true if this element has a predecessor

hasSuccessor

public abstract boolean hasSuccessor()
Checks if this element has a successor.
Returns:
true if this element has a successor

getPredecessorNumber

public abstract int getPredecessorNumber()
Gets the number of predecessors of this element.
Returns:
number of predecessors

getSuccessorNumber

public abstract int getSuccessorNumber()
Gets the number of successors of this element.
Returns:
number of successors

getPredecessor

public abstract FlowElement getPredecessor(int index)
Gets the predecessor from a particular slot.
Parameters:
index - index of the predecessor
Returns:
predecessor from a slot

getSuccessor

public abstract FlowElement getSuccessor(int index)
Gets the successor from a particular slot.
Parameters:
index - index of the successor
Returns:
successor from a slot

setPredecessor

public abstract void setPredecessor(FlowElement predecessor,
                                    int index)
Sets a new predecessor to a slot.
Parameters:
predecessor - new predecessor
index - slot to append the predecessor to

setSuccessor

public abstract void setSuccessor(FlowElement successor,
                                  int index)
Sets a new successor to a slot.
Parameters:
successor - new successor
index - index of the successor

react

protected abstract void react()
Abstract method for reacting on an incoming message.

register

public void register(MessageBroker broker)
Registers this flow element at a message broker.
Parameters:
broker - message broker

run

public void run()
Run method.
Specified by:
run in interface java.lang.Runnable

acquireChannel

public void acquireChannel(java.lang.Object sender)
Wakes up this flow element for listening at the message channel.
Specified by:
acquireChannel in interface MessageRecipient
Parameters:
sender - sender of the wake up signal

setBroker

public void setBroker(MessageBroker broker)
Sets a new message broker.
Parameters:
broker - new message broker

setSync

public void setSync(Sync sync)
Sets a new sychronization object.
Parameters:
sync - new sychronization object

setChannel

public void setChannel(MessageChannel channel)
Sets a new message channel.
Parameters:
channel - new message channel

toString

public java.lang.String toString()
Returns the name of this flow element.
Overrides:
toString in class java.lang.Object

eaLib API Docs
Last Modified : January 7 2002

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