gov.nist.antd.optical.path
Class PathContainer

java.lang.Object
  |
  +--gov.nist.antd.optical.AbstractObject
        |
        +--gov.nist.antd.optical.path.PathContainer

public class PathContainer
extends AbstractObject

The BackupContainer contains a list of backup routes. Different algorithms can create different backup containers. This class Version 2.0 is NOT BACKWARD COMPATIBLE

 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.

Version:
2.4

 VERSION CONTROL
 -------------------------------------------------------------------------
 Name     - YYYY/MM/DD - VERSION - ACTION
 borchert - 2001/06/28 - 1.0     - Source created.
 borchert - 2001/10/09 - 2.0     - Changed the PathContainer to be compatible
                                   to deal with multiple networks. This is  
                                   such a major change that we decided to 
                                   change the version in lieu of the revision
                                   number. The PathContainer is NOT BACKWARD 
                                   COMPATIBLE!
 rouil    - 2002/03/05 - 2.1     - Add removeContainers(OpNet).
 borchert - 2002/04/25 - 2.2     - Change reference from OpNet to Glass.
 borchert - 2002/06/06 - 2.3     - Changed Reference from OpticalRoute to 
                                   OpticalConnection.
 rouil    - 2002/06/20 - 2.4     - Updated OXCEdgeRouter to ExtRouter.
 

Author:
borchert
, rouil

Field Summary
private  java.lang.String name
          The name of the container.
private static java.util.Hashtable NETWORKS
          This hashtable contains the containers of each network..
private  int noPath
          Number of backup paths that are stored in the container.
private  OpticalConnection[] route
          This routes are used for backup purposes.
 
Fields inherited from class gov.nist.antd.optical.AbstractObject
INITIAL_ARRAY_SIZE
 
Constructor Summary
private PathContainer(java.lang.String name)
          Generates a path container with the given name.
 
Method Summary
 void addConnection(Glass net, OpticalConnection newRoute)
          Add a new Route to the container.
 void addRoute(Glass net, OpticalConnection newRoute)
          Deprecated. use addConnection (Glass, OpticalConnection)
protected  java.lang.Object[] createArray(int size)
          Creates an array of the specified size.
static void deleteContainer(Glass net, java.lang.String name)
          Determines the pathcontainer with the specified name and removed it out of the internal container list.
 OpticalConnection[] getAllConnections()
          Returns all connections stored in this container.
 OpticalConnection[] getAllRoutes()
          Deprecated. use getAllConnections ()
 OpticalConnection[] getConnection(ExtRouter source, ExtRouter destination)
          Determines the requested routes stored for source and destination.
 OpticalConnection getConnection(int id)
          Determines if the requested connection is stored.
 OpticalConnection[] getConnection(OpticalLink link)
          Returns the OpticalConnection for the specific OpticalLink.
static PathContainer getContainer(Glass net, java.lang.String name)
          Determines the pathcontainer with the specified name.
private static java.util.Hashtable getContainerHash(Glass net)
          Determines the pathcontainer hash.
static java.util.Hashtable getContainers(Glass net)
          Get the containers
 java.lang.String getName()
          Returns the name of the container.
 OpticalConnection[] getRoute(ExtRouter source, ExtRouter destination)
          Deprecated. use getConnection (ExtRouter, ExtRouter)
 OpticalConnection getRoute(int id)
          Deprecated. use getConnection
 OpticalConnection[] getRoute(OpticalLink link)
          Deprecated. use getConnection (OpticalLink)
 int getSize()
          Returns The number of paths stored in the container.
 void removeConnection(OpticalConnection oldRoute)
          Removes the given connection out of the container.
static void removeContainers(Glass net)
          Remove the containers of the given net
 void removeRoute(OpticalConnection oldRoute)
          Deprecated. use removeConnection (OpticalConnection)
 void setName(java.lang.String newName)
          Set The name of the container.
protected  void setNoElements(int size)
          Set the number of elements.
 
Methods inherited from class gov.nist.antd.optical.AbstractObject
addElement, clear, isElementOf, removeElement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NETWORKS

private static final java.util.Hashtable NETWORKS
This hashtable contains the containers of each network..


noPath

private int noPath
Number of backup paths that are stored in the container.


name

private java.lang.String name
The name of the container. Normally this name is the name of the used algorithm.


route

private OpticalConnection[] route
This routes are used for backup purposes.

Constructor Detail

PathContainer

private PathContainer(java.lang.String name)
Generates a path container with the given name.

Parameters:
name - The name of the path container.
Method Detail

getContainer

public static PathContainer getContainer(Glass net,
                                         java.lang.String name)
Determines the pathcontainer with the specified name. If no such container exists this method will create one and return the new created one.

Parameters:
net - The network the container has to be searched in.
name - The name of the path container.
Returns:
The requested PathContainer.
Throws:
java.lang.NullPointerException - if the net is null.

getContainers

public static java.util.Hashtable getContainers(Glass net)
Get the containers

Parameters:
net - The OpNet that stores the path containers.
Returns:
The hashtable with the containers.

removeContainers

public static void removeContainers(Glass net)
Remove the containers of the given net

Parameters:
net - The OpNet to remove

deleteContainer

public static void deleteContainer(Glass net,
                                   java.lang.String name)
Determines the pathcontainer with the specified name and removed it out of the internal container list.

Parameters:
net - The OpNet that stores the path containers.
name - The name of the path container.

getContainerHash

private static java.util.Hashtable getContainerHash(Glass net)
                                             throws java.lang.NullPointerException
Determines the pathcontainer hash.

Parameters:
net - The network the pathcontainer belongs to.
Returns:
The pathcontainer hash table that belongs to the given network.
Throws:
java.lang.NullPointerException - If the given net is null.
Since:
2.0

addRoute

public void addRoute(Glass net,
                     OpticalConnection newRoute)
Deprecated. use addConnection (Glass, OpticalConnection)

Add a new Route to the container.

Parameters:
net - The OpNet that stores the path containers.
newRoute - the new OpticalConnection that has to be added to the container.

addConnection

public void addConnection(Glass net,
                          OpticalConnection newRoute)
Add a new Route to the container.

Parameters:
net - The OpNet that stores the path containers.
newRoute - the new OpticalConnection that has to be added to the container.

getAllRoutes

public OpticalConnection[] getAllRoutes()
Deprecated. use getAllConnections ()

Returns all OpticalRoutes stored in this container.

Returns:
the routes or null if non existst.

getAllConnections

public OpticalConnection[] getAllConnections()
Returns all connections stored in this container.

Returns:
the array of connections.

getRoute

public OpticalConnection getRoute(int id)
Deprecated. use getConnection

Determines if the requested route is stored.

Parameters:
id - The ID of the route.
Returns:
the route that is found or null.

getConnection

public OpticalConnection getConnection(int id)
Determines if the requested connection is stored.

Parameters:
id - The ID of the connection.
Returns:
the connection that is found or null.

getRoute

public OpticalConnection[] getRoute(ExtRouter source,
                                    ExtRouter destination)
Deprecated. use getConnection (ExtRouter, ExtRouter)

Determines the requested routes stored for source and destination.

Parameters:
source - The source node.
destination - The destination node.
Returns:
the routes that are found or null.

getConnection

public OpticalConnection[] getConnection(ExtRouter source,
                                         ExtRouter destination)
Determines the requested routes stored for source and destination.

Parameters:
source - The source node.
destination - The destination node.
Returns:
the routes that are found or null.

getRoute

public OpticalConnection[] getRoute(OpticalLink link)
Deprecated. use getConnection (OpticalLink)

Returns the OpticalConnection for the specific OpticalLink. This method looks for routes in both directions of the link. a->b and b->a.

Parameters:
link - The OpticalLink the backup path is requested for.
Returns:
the protection route or null if not existent.

getConnection

public OpticalConnection[] getConnection(OpticalLink link)
Returns the OpticalConnection for the specific OpticalLink. This method looks for routes in both directions of the link. a->b and b->a.

Parameters:
link - The OpticalLink the backup path is requested for.
Returns:
the protection route or null if not existent.

removeRoute

public void removeRoute(OpticalConnection oldRoute)
Deprecated. use removeConnection (OpticalConnection)

Removes the given route out of the container.

Parameters:
oldRoute - the OpticalConnection that has to be removed.

removeConnection

public void removeConnection(OpticalConnection oldRoute)
Removes the given connection out of the container.

Parameters:
oldRoute - the OpticalConnection that has to be removed.

createArray

protected java.lang.Object[] createArray(int size)
Creates an array of the specified size. The implementation class must set this array to the internal work array. Otherwise the method addElements will throw an exception later on. The implementation should be synchronized.

Specified by:
createArray in class AbstractObject
Parameters:
size - the given size.
Returns:
an array of the specified size.

getName

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

Returns:
the container's name.

setName

public void setName(java.lang.String newName)
Set The name of the container.

Parameters:
newName - the new name of the container.

setNoElements

protected void setNoElements(int size)
Set the number of elements. The implementation should be synchronized.

Specified by:
setNoElements in class AbstractObject
Parameters:
size - the new number of elements.

getSize

public int getSize()
Returns The number of paths stored in the container.

Returns:
The number of paths stored in the container.