net.jolsrv2.repository.neighbourhood
Class TwoHopSet

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

public final class TwoHopSet
extends java.lang.Object

The class implements the two hop set, as specified in OLSRv2.

Author:
Andreas Schjønhaug

Method Summary
 java.lang.Object clone()
          Implementation of the singleton design pattern.
 java.util.ArrayList<TwoHopTuple> getTuples()
          Returns the two hop tuples
 java.util.ArrayList<TwoHopTuple> getTuples(CidrAddress cidrBlock)
          The method gets all two hop tuples associated with a certain local CIDR address
static TwoHopSet getTwoHopSet()
          Implementation of the singleton design pattern
 boolean populate(CidrAddress receivingCAddress, CidrAddress sendingCAddress, long validityTime, java.util.ArrayList<CidrAddress> cidrAddresses, java.util.ArrayList<Tlv> tlvs)
          Populates the two hop set as suggested in the specification
 boolean purge()
          The method purges the set, deleting expired entries
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getTwoHopSet

public static TwoHopSet getTwoHopSet()
Implementation of the singleton design pattern

Returns:
the two hop 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

populate

public boolean populate(CidrAddress receivingCAddress,
                        CidrAddress sendingCAddress,
                        long validityTime,
                        java.util.ArrayList<CidrAddress> cidrAddresses,
                        java.util.ArrayList<Tlv> tlvs)
Populates the two hop set as suggested in the specification

Parameters:
receivingCAddress - the receiving CIDR address
sendingCAddress - the sending CIDR address
validityTime - the validity time
cidrAddresses - the CIDR address
tlvs - the TLVs
Returns:
true if a change in the two hop set is detected

getTuples

public java.util.ArrayList<TwoHopTuple> getTuples(CidrAddress cidrBlock)
The method gets all two hop tuples associated with a certain local CIDR address

Parameters:
cidrBlock - the local CIDR address
Returns:
an ArrayList of two hop tuples associated with an address

purge

public boolean purge()
The method purges the set, deleting expired entries

Returns:
true if a change is detected

getTuples

public java.util.ArrayList<TwoHopTuple> getTuples()
Returns the two hop tuples

Returns:
the two hop tuples