gov.nist.antd.merlin.algorithm
Class AlgorithmTemplate

java.lang.Object
  |
  +--gov.nist.antd.merlin.algorithm.AlgorithmTemplate
All Implemented Interfaces:
Algorithm, DMLDump
Direct Known Subclasses:
BackupLink, BestFit, GWUTemplate, KspDisjoint, ShortestPathDistance, ShortestPathSRLG

public abstract class AlgorithmTemplate
extends java.lang.Object
implements Algorithm, DMLDump

This class represents a template for withing algorithms. The algorithm writer has to implement the abstract execute method.

 This class was developed at the National Institute of Standards and
 Technology by employees of the Federal Government in the course of
 their official duties. Pursuant to title 17 Section 105 of the United
 States Code this software is not subject to copyright protection and
 is in the public domain.
 NIST assumes no responsibility whatsoever for its use by other parties,
 and makes no guarantees, expressed or implied, about its quality,
 reliability, or any other characteristic.
 
We would appreciate acknowledgement if the software is used.
NIST ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION AND DISCLAIM ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.

Author:
borchert
, rouil

Field Summary
private  boolean debug
          Indicates if the algorithm is in the dwbug mode or not.
private  java.lang.String name
          The name of the algorithm.
 
Fields inherited from interface gov.nist.antd.optical.algorithm.Algorithm
ROUTING, RWA, UNKNOWN, WAVELENGTH
 
Constructor Summary
AlgorithmTemplate()
          Default constructor
 
Method Summary
 void config(com.renesys.raceway.DML.Configuration cfg, Glass net)
          Configure the Centralized Algorithm.
 java.lang.Object[] execute(Glass net, OpticalConnection[] routes, java.lang.Object[] parameter)
          This method executes the algorithm.
abstract  java.util.Vector execute(Glass net, java.util.Vector listOfRoutes, java.util.Vector parameter)
          This method executes the algorithm.
 java.lang.String getName()
          Returns the name of the algorithm.
 byte getType()
          Returns the algorithms type.
 boolean isDebug()
          Indicates if the algorithm is in the debug mode or not.
 void setDebug(boolean newValue)
          Set the debug mode.
 void setName(java.lang.String newName)
          Set the name of the algorithm.
 java.lang.String toDML()
          This method generates the DML representation of this class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

private java.lang.String name
The name of the algorithm. Specified in the DML file.


debug

private boolean debug
Indicates if the algorithm is in the dwbug mode or not.

Constructor Detail

AlgorithmTemplate

public AlgorithmTemplate()
Default constructor

Method Detail

config

public void config(com.renesys.raceway.DML.Configuration cfg,
                   Glass net)
            throws com.renesys.raceway.DML.configException
Configure the Centralized Algorithm.

Specified by:
config in interface Algorithm
Parameters:
cfg - configuration
net - The OpNet that contains the topology.
Throws:
com.renesys.raceway.DML.configException - when a configuration exception occurs.

getName

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

Specified by:
getName in interface Algorithm
Returns:
The name of the algorithm.

setName

public void setName(java.lang.String newName)
Set the name of the algorithm. This method will be called by the configuration of the algorithm. Don't cann it directly.

Parameters:
newName - The name of the algorithm.

isDebug

public boolean isDebug()
Indicates if the algorithm is in the debug mode or not.

Returns:
true if the algorithm is in the debug mode.

setDebug

public void setDebug(boolean newValue)
Set the debug mode.

Parameters:
newValue - Defines if the algorihtm is in the debug mode or not.

toDML

public java.lang.String toDML()
This method generates the DML representation of this class.

Specified by:
toDML in interface DMLDump
Returns:
The DML configuration as String

execute

public java.lang.Object[] execute(Glass net,
                                  OpticalConnection[] routes,
                                  java.lang.Object[] parameter)
                           throws AlgorithmException
This method executes the algorithm.

Specified by:
execute in interface Algorithm
Parameters:
net - the topologies network.
routes - An Array of routes.
parameter - An Array of parameters for the algorithm.
Returns:
The passed array.
Throws:
AlgorithmException - An AlgorithmException occured.

execute

public abstract java.util.Vector execute(Glass net,
                                         java.util.Vector listOfRoutes,
                                         java.util.Vector parameter)
                                  throws AlgorithmException
This method executes the algorithm.

Specified by:
execute in interface Algorithm
Parameters:
net - the topologies network.
listOfRoutes - The vector containing the routes.
parameter - not used here.
Returns:
The vector containing the result.
Throws:
AlgorithmException - An AlgorithmException occured.

getType

public byte getType()
Returns the algorithms type. This method has to be overwritten to be able to use the implemented algorithm as Routing or Wavelength algorithm.

Specified by:
getType in interface Algorithm
Returns:
the value Algorithm.UNKNOWN.
Since:
1.1