net.jolsrv2.repository.neighbourhood
Class LinkSet

java.lang.Object
  extended by net.jolsrv2.repository.neighbourhood.LinkSet

public final class LinkSet
extends java.lang.Object

The class implements the link set, as specified in OLSRv2.

Author:
Andreas Schjønhaug

Method Summary
 java.lang.Object clone()
          Implementation of the singleton design pattern.
 boolean contains(CidrAddress from)
          Checks if the link set has a link tuple with a certain local CIDR address
 boolean contains(CidrAddress from, CidrAddress to, Values status)
          Checks if the link set has a link tuple with a certain local CIDR address, neighbour CIDR address and link status
static LinkSet getLinkSet()
          Implementation of the singleton design pattern
 java.util.TreeSet<LinkTuple> getTuples()
          Returns the link tuples in the link set
 java.util.ArrayList<LinkTuple> getTuples(CidrAddress cidrBlock)
          Searches for and returns link tuples having a certain local CIDR address
 java.util.ArrayList<LinkTuple> getTuples(Values v)
          Searches for and returns link tuples having a certain TLV value
 Values getWillingness(CidrAddress from)
          Returns the willigness of a link tuple with a certain local CIDR address
 boolean populate1(CidrAddress receivingCAddress, CidrAddress sourceCAddress, long validityTime)
          Populating the link set witht the addresses found in the LIB.
 void populate2(CidrAddress receivingCAddress, CidrAddress sourceCAddress, long validityTime, long intervalTime, Values willingness, java.util.ArrayList<CidrAddress> cidrAddresses, java.util.ArrayList<Tlv> tlvs)
          Populating the link set with the addresses found in the address blocks other than the LIB.
 boolean purge()
          Purges the entries in the set
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getLinkSet

public static LinkSet getLinkSet()
Implementation of the singleton design pattern

Returns:
the link set

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Implementation of the singleton design pattern. This method is used to ensure that the class can not be cloned.

Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException

purge

public boolean purge()
Purges the entries in the set

Returns:
true if a change is detected

populate1

public boolean populate1(CidrAddress receivingCAddress,
                         CidrAddress sourceCAddress,
                         long validityTime)
Populating the link set witht the addresses found in the LIB.

Parameters:
receivingCAddress - the receiving CIDR address
sourceCAddress - the source CIDR address
validityTime - the validity time
Returns:
true if a change in the link set is detected

populate2

public void populate2(CidrAddress receivingCAddress,
                      CidrAddress sourceCAddress,
                      long validityTime,
                      long intervalTime,
                      Values willingness,
                      java.util.ArrayList<CidrAddress> cidrAddresses,
                      java.util.ArrayList<Tlv> tlvs)
Populating the link set with the addresses found in the address blocks other than the LIB.

Parameters:
receivingCAddress - the receiving CIDR address
sourceCAddress - the source CIDR address
validityTime - the validity time
intervalTime - the interval time
willingness - the willingness
cidrAddresses - the CIDR addresses
tlvs - the TLVs

getTuples

public java.util.ArrayList<LinkTuple> getTuples(CidrAddress cidrBlock)
Searches for and returns link tuples having a certain local CIDR address

Parameters:
cidrBlock - the local CIDR address to look for
Returns:
an ArrayList of the link tuples found

getTuples

public java.util.ArrayList<LinkTuple> getTuples(Values v)
Searches for and returns link tuples having a certain TLV value

Parameters:
v - the TLV value to look for
Returns:
an ArrayList of the link tuples found

getWillingness

public Values getWillingness(CidrAddress from)
Returns the willigness of a link tuple with a certain local CIDR address

Parameters:
from - the local CIDR address
Returns:
the willingness, or null if the link tuple is not found

contains

public boolean contains(CidrAddress from)
Checks if the link set has a link tuple with a certain local CIDR address

Parameters:
from - the local CIDR address to look for
Returns:
true if the link tuple is found, false otherwise

contains

public boolean contains(CidrAddress from,
                        CidrAddress to,
                        Values status)
Checks if the link set has a link tuple with a certain local CIDR address, neighbour CIDR address and link status

Parameters:
from - the local CIDR address
to - the neighbour CIDR address
status - the link status
Returns:
true if the link tuple exists, false otherwise

getTuples

public java.util.TreeSet<LinkTuple> getTuples()
Returns the link tuples in the link set

Returns:
the link tuples