gov.nist.antd.merlin.protocol.util
Class LinkStateTable

java.lang.Object
  |
  +--gov.nist.antd.merlin.protocol.util.LinkStateTable

public class LinkStateTable
extends java.lang.Object

This class contains the linkstate information of the connected links.

 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  Host host
          The host this table is assigned to.
private  java.util.Hashtable linkHashTable
          Contains the hashtables for each link.
 
Constructor Summary
LinkStateTable(Host ownerHost)
          Creates and initializes the linkstatetable.
 
Method Summary
 java.util.Vector addFailure(Fiber failedFiber)
          Add all Lambdas in this fiber as failed.
 boolean addFailure(Lambda failedLambda)
          Add the given lambda to its link table.
 java.util.Vector addFailure(OpticalLink failedLink)
          Add all Lambdas in this Link as failed.
protected  java.util.Vector getLambdaVectorForLink(OpticalLink link)
          Retruns the Vector containing the linkstate information for the specific link.
 boolean isRegisteredAsFailed(Fiber fiber)
          Returns if this fiber is registered as failed.
 boolean isRegisteredAsFailed(Lambda lambda)
          Returns if the Lambda is already registered as failed.
 boolean isRegisteredAsFailed(OpticalLink link, boolean onlyIncoming)
          Returns if this link is registered as failed.
 java.util.Vector removeFailure(Fiber fiber)
          Only not real failed lambdas of the fiber will be removed.
 boolean removeFailure(Lambda lambda)
          Removes the given lambda from the failure table if it exists.
 java.util.Vector removeFailure(OpticalLink link)
          Only not real failed lambdas of the link will be removed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

linkHashTable

private java.util.Hashtable linkHashTable
Contains the hashtables for each link. key is Link, value is Hashtable


host

private Host host
The host this table is assigned to.

Constructor Detail

LinkStateTable

public LinkStateTable(Host ownerHost)
               throws java.lang.NullPointerException
Creates and initializes the linkstatetable.

Throws:
java.lang.NullPointerException - if the host is null.
Method Detail

getLambdaVectorForLink

protected java.util.Vector getLambdaVectorForLink(OpticalLink link)
Retruns the Vector containing the linkstate information for the specific link.


addFailure

public boolean addFailure(Lambda failedLambda)
Add the given lambda to its link table. If the table does not exist it will be created.

Parameters:
failedLambda - the failed Lambda. It can be logical or physical failed.
Returns:
true if the lambda is added, false if the lambda is already included.

addFailure

public java.util.Vector addFailure(Fiber failedFiber)
Add all Lambdas in this fiber as failed.

Parameters:
failedFiber - the fiber that failed. It can be logical or physical failed.
Returns:
a Vector of all Lambdas that are newly added.

addFailure

public java.util.Vector addFailure(OpticalLink failedLink)
Add all Lambdas in this Link as failed.

Parameters:
failedLink - the link that failed. It can be logical or physical failed.
Returns:
a Vector of all Lambdas that are newly added.

removeFailure

public boolean removeFailure(Lambda lambda)
Removes the given lambda from the failure table if it exists. The lambda will only be removed if the isFailure value of the lambda returns false.

Parameters:
lambda - the lambda that has to be removed.
Returns:
true if the Lambda was removed.

removeFailure

public java.util.Vector removeFailure(Fiber fiber)
Only not real failed lambdas of the fiber will be removed. To make sure if the fiber is still failed (logically) call isRegisteredAsFailed.

Parameters:
fiber - The fiber whose lambdas have to be removed from the failure table.
Returns:
A Vector containing all lambda's that are removed.
See Also:
isRegisteredAsFailed(Fiber)

removeFailure

public java.util.Vector removeFailure(OpticalLink link)
Only not real failed lambdas of the link will be removed. To make sure if the link is still failed (logically) call isRegisteredAsFailed.

Parameters:
link - The link whose lambdas have to be removed from the failure table
Returns:
A Vector containing all lambda's that are removed.
See Also:
LinkStateTable#isRegisteredAsFailed(OpticalLink)

isRegisteredAsFailed

public boolean isRegisteredAsFailed(Lambda lambda)
Returns if the Lambda is already registered as failed.

Parameters:
lambda - the lambda that has to be checked.
Returns:
true if the lambda is already stored as failed.

isRegisteredAsFailed

public boolean isRegisteredAsFailed(Fiber fiber)
Returns if this fiber is registered as failed. This will be calculated by all lambdas. If all lambdas are registered as failed, this fiber is also registered as failed.

Parameters:
fiber - the fiber that has to be tested.
Returns:
true is all lambdas of the fiber are failed, otherwise false.

isRegisteredAsFailed

public boolean isRegisteredAsFailed(OpticalLink link,
                                    boolean onlyIncoming)
Returns if this link is registered as failed. This will be calculated by checking all fibers. If all fibers are registered as failed, this link is failed too. The resut depends on the amount of fibers that has to be checked. A Link can be registered as failed if only the incoming fibers will be checked. This is specified by the attribute
onlyIncoming

Parameters:
link - the link that has to be tested.
onlyIncoming - true = check only incoming fibers, false = check all
Returns:
true is all fibers of the link are failed, otherwise false.