de.dfki.lt.sdl
Class Mediators

java.lang.Object
  extended by de.dfki.lt.sdl.Mediators
All Implemented Interfaces:
IMediator

public class Mediators
extends java.lang.Object
implements IMediator

this is the default (super)class of the three mediators o seq: sequence or concatenation, o par: parallelism or concurrency, o fix: fixpoint or unrestricted iteration, providing some default behavior; I originaly thought that this functionality (without the trival default sequence mediator) had to be part of the module interface; however, a module should usually NOT know what a fixpoint is (in case of module iteration); moreover, when moving the mediators into the module interface, an asymmetry for the parallelism pattern will occur; NOTE: the mediators do NOT set the input NOR the output of their module parameters!! note that in case we want to have specific mediators for certain modules/ module combinations, we can easily achieve this by providing additional instance methods with different signatures in subclasses of Mediators

Since:
JDK 1.3
See Also:
IMediator, IModule, Modules

Constructor Summary
Mediators()
          no functionality in this constructor, only needed to call specialized instance mediators
 
Method Summary
 java.lang.Object fix(IModule module)
          the fixpoint mediator checks whether the application of the unary module method run() to the input is equivalent to the result value; if not, it calls run() on the output again, until a fixpoint has been reached (which must, of course, not exist, i.e., the computation must not terminate); note that this default method assumes that input AND output of a module are of the same data type and that the equals() method on the type of input/output works properly; in order to guarantee this, the compareTo() and the equals() method of elements in a structured input/output must also work properly, perhaps even the hashCode() method; note further that fix() does NOT set the input NOR the output of the module!!
 java.lang.Object par(IModule[] modules)
          the default parallelism mediator simply groups the output of the modules in an array (of length equals to the number of incoming modules)
 java.lang.Object seq(IModule module1, IModule module2)
          the implemented default behavior for the sequence mediator is identity, returning the output of module1
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Mediators

public Mediators()
no functionality in this constructor, only needed to call specialized instance mediators

Method Detail

seq

public java.lang.Object seq(IModule module1,
                            IModule module2)
the implemented default behavior for the sequence mediator is identity, returning the output of module1

Specified by:
seq in interface IMediator
See Also:
for a possible implementation

par

public java.lang.Object par(IModule[] modules)
the default parallelism mediator simply groups the output of the modules in an array (of length equals to the number of incoming modules)

Specified by:
par in interface IMediator
See Also:
for a possible implementation

fix

public java.lang.Object fix(IModule module)
the fixpoint mediator checks whether the application of the unary module method run() to the input is equivalent to the result value; if not, it calls run() on the output again, until a fixpoint has been reached (which must, of course, not exist, i.e., the computation must not terminate); note that this default method assumes that input AND output of a module are of the same data type and that the equals() method on the type of input/output works properly; in order to guarantee this, the compareTo() and the equals() method of elements in a structured input/output must also work properly, perhaps even the hashCode() method; note further that fix() does NOT set the input NOR the output of the module!!

Specified by:
fix in interface IMediator
See Also:
for a possible implementation