Evolvica Core API Version 0.6.2
Last Modified: June 29 2004

org.evolvica.engine
Interface IAlgorithm

All Known Implementing Classes:
AbstractAlgorithm

public interface IAlgorithm

Interface for an algorithm.

Since:
0.4.0
Version:
$Revision: 1.10 $ $Date: 2004/05/26 11:58:23 $
Author:
Andreas Rummler

Method Summary
 void addElement(IElement element)
          Adds an element to this algorithm.
 void addMetadataChangeListener(java.beans.PropertyChangeListener listener)
          Adds a property change listener that reacts on metadata changes to this algorithm.
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Adds a property change listener to this algorithm.
 void connect(IElement source, int output, IElement target, int input)
          Connects two elements.
 void connect(IOperator source, int output, IOperator target, int input)
          Connects two operators.
 int connectionSize()
          Returns the number of connections in this algorithm.
 int elementSize()
          Returns the number of elements contained in this algorithm.
 void execute()
          Executes the algorithm.
 void firePropertyChangeEvent(java.beans.PropertyChangeEvent event)
          Fires a property change event.
 IConnection getConnection(IElement source, int output, IElement target, int input)
          Returns the connection between two elements.
 IConnection getConnection(IOperator source, int output, IOperator target, int input)
          Returns the connection between two operators.
 IElement getElementById(java.lang.String id)
          Gets an element by its ID.
 Metadata getMetadata(java.lang.Object source, java.lang.String path)
          Returns a metadata object from the associated metadata store.
 java.lang.String getName()
          Returns the name of the algorithm.
 IRunner getRunner()
          Gets the algorithm runner.
 IValidator getValidator()
          Gets the algorithm validator.
 java.util.Iterator iterateConnections()
          Iterates all connections in this algorithm.
 java.util.Iterator iterateElements()
          Iterates all elements in this algorithm.
 void removeConnection(IConnection connection)
          Removes a connection from this algorithm.
 void removeElement(IElement element)
          Removes an element from this algorithm.
 void removeMetadataChangeListener(java.beans.PropertyChangeListener listener)
          Removes a metadata property change listener from this algorithm.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Removes a property change listener from this algorithm.
 void restoreMetadata(IMetadataProvider provider)
          Restores the metadata from the given metadata provider.
 void serializeMetadata(IMetadataSerializer serializer)
          Serializes this algorithm's metadata by using the given serializer.
 void setMetadata(java.lang.Object source, Metadata data)
          Sets a metadata object.
 void setName(java.lang.String name)
          Sets the name of the algorithm.
 void setRunner(IRunner runner)
          Sets a new algorithm runner.
 void setup()
          Sets up the algorithm.
 void setValidator(IValidator validator)
          Sets the algorithm validator.
 void teardown()
          Teardown method.
 

Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a property change listener to this algorithm.

Parameters:
listener - property change listener to be added

addMetadataChangeListener

public void addMetadataChangeListener(java.beans.PropertyChangeListener listener)
Adds a property change listener that reacts on metadata changes to this algorithm.

Parameters:
listener - property change listener to be added

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a property change listener from this algorithm.

Parameters:
listener - property change listener to be removed

removeMetadataChangeListener

public void removeMetadataChangeListener(java.beans.PropertyChangeListener listener)
Removes a metadata property change listener from this algorithm.

Parameters:
listener - property change listener to be removed

firePropertyChangeEvent

public void firePropertyChangeEvent(java.beans.PropertyChangeEvent event)
Fires a property change event.

Parameters:
event - event to be fired

setup

public void setup()
           throws java.lang.Exception
Sets up the algorithm. This method is called before the algorithm is started.

Throws:
java.lang.Exception - thrown if the setup stage fails

execute

public void execute()
Executes the algorithm.


teardown

public void teardown()
              throws java.lang.Exception
Teardown method. This method is called after an algorithm has finished its execution.

Throws:
java.lang.Exception - thrown if teardown stage fails

getName

public java.lang.String getName()
Returns the name of the algorithm.

Returns:
name of the algorithm

setName

public void setName(java.lang.String name)
Sets the name of the algorithm.

Parameters:
name - name of the algorithm

getMetadata

public Metadata getMetadata(java.lang.Object source,
                            java.lang.String path)
Returns a metadata object from the associated metadata store.

Parameters:
source - source object
path - metadata path
Returns:
metadata object or null if no such object exists

restoreMetadata

public void restoreMetadata(IMetadataProvider provider)
Restores the metadata from the given metadata provider.

Parameters:
provider - metadata provider

serializeMetadata

public void serializeMetadata(IMetadataSerializer serializer)
Serializes this algorithm's metadata by using the given serializer.

Parameters:
serializer - metadata serializer

setMetadata

public void setMetadata(java.lang.Object source,
                        Metadata data)
Sets a metadata object.

Parameters:
source - source object
data - metadata object

addElement

public void addElement(IElement element)
Adds an element to this algorithm.

Parameters:
element - alement to add

getElementById

public IElement getElementById(java.lang.String id)
Gets an element by its ID.

Parameters:
id - id of the element
Returns:
element with the given ID or null

iterateElements

public java.util.Iterator iterateElements()
Iterates all elements in this algorithm.

Returns:
iterator over all algorithm elements.

removeElement

public void removeElement(IElement element)
Removes an element from this algorithm.

Parameters:
element - element to be removed

elementSize

public int elementSize()
Returns the number of elements contained in this algorithm.

Returns:
number of elements in this algorithm

connect

public void connect(IElement source,
                    int output,
                    IElement target,
                    int input)
Connects two elements.

Parameters:
source - source element
output - source slot
target - target element
input - target slot

connect

public void connect(IOperator source,
                    int output,
                    IOperator target,
                    int input)
Connects two operators.

Parameters:
source - source operator
output - source slot
target - target operator
input - target slot

getConnection

public IConnection getConnection(IElement source,
                                 int output,
                                 IElement target,
                                 int input)
Returns the connection between two elements.

Parameters:
source - source element
output - source slot
target - target element
input - target slot
Returns:
connection between the given elements or null if no such connection exists

getConnection

public IConnection getConnection(IOperator source,
                                 int output,
                                 IOperator target,
                                 int input)
Returns the connection between two operators.

Parameters:
source - source operator
output - source slot
target - target operator
input - target slot
Returns:
connection between the given operators or null if no such connection exists

iterateConnections

public java.util.Iterator iterateConnections()
Iterates all connections in this algorithm.

Returns:
iterator over all connections

removeConnection

public void removeConnection(IConnection connection)
Removes a connection from this algorithm.

Parameters:
connection - connection to be removed.

connectionSize

public int connectionSize()
Returns the number of connections in this algorithm.

Returns:
number of connections

getRunner

public IRunner getRunner()
Gets the algorithm runner.

Returns:
algorithm runner

setRunner

public void setRunner(IRunner runner)
               throws java.beans.PropertyVetoException
Sets a new algorithm runner.

Parameters:
runner - new algorithm runner
Throws:
java.beans.PropertyVetoException - thrown if algorithm runner is null

getValidator

public IValidator getValidator()
Gets the algorithm validator.

Returns:
the current validator.

setValidator

public void setValidator(IValidator validator)
Sets the algorithm validator.

Parameters:
validator - new algorithm validator

Evolvica Core API Version 0.6.2
Last Modified: June 29 2004

Copyright © 2000-2004 Technical University of Ilmenau, Department Electronic Circuits and Systems