net.jolsrv2.repository.neighbourhood
Class LinkTuple

java.lang.Object
  extended by net.jolsrv2.repository.neighbourhood.LinkTuple
All Implemented Interfaces:
java.util.Comparator<LinkTuple>

public class LinkTuple
extends java.lang.Object
implements java.util.Comparator<LinkTuple>

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

Author:
Andreas Schjønhaug

Constructor Summary
LinkTuple(CidrAddress localCAddress, CidrAddress neighbourCAddress, long symTime, long time)
          Constructor
 
Method Summary
 int compare(LinkTuple l1, LinkTuple l2)
          Compares the components of two link tuples, to determine how they should be sorted
 boolean equals(LinkTuple tuple)
          Compares the components of two link tuples, to determine if they are equal
 long getAsymTime()
          Gets the aymmetric time
 CidrAddress getLocalCAddress()
          Returns the local CIDR address
 CidrAddress getNeighbourCAddress()
          Returns the neighbour CIDR address
 Values getStatus()
          Gets the link status
 long getSymTime()
          Gets the symmetric time
 long getTime()
          Return the time
 Values getWillingness()
          Return the willingness
 void setAsymTime(long asymTime)
          Sets the asymmetric time
 void setSymTime(long symTime)
          Sets the symmetric time
 void setTime(long time)
          Sets the time
 void setWillingness(Values willingness)
          Sets the willingness
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

LinkTuple

public LinkTuple(CidrAddress localCAddress,
                 CidrAddress neighbourCAddress,
                 long symTime,
                 long time)
Constructor

Parameters:
localCAddress - the local CIDR address
neighbourCAddress - the neighbour CIDR address
symTime - the symmetric time
time - the time
Method Detail

getNeighbourCAddress

public CidrAddress getNeighbourCAddress()
Returns the neighbour CIDR address

Returns:
the neighbour CIDR address

getLocalCAddress

public CidrAddress getLocalCAddress()
Returns the local CIDR address

Returns:
the local CIDR address

getTime

public long getTime()
Return the time

Returns:
the time

setTime

public void setTime(long time)
Sets the time

Parameters:
time - the time

getWillingness

public Values getWillingness()
Return the willingness

Returns:
the willingness

setWillingness

public void setWillingness(Values willingness)
Sets the willingness

Parameters:
willingness - the willingness

getSymTime

public long getSymTime()
Gets the symmetric time

Returns:
the symmetric time

setSymTime

public void setSymTime(long symTime)
Sets the symmetric time

Parameters:
symTime - the symmetric time

getAsymTime

public long getAsymTime()
Gets the aymmetric time

Returns:
the asymmetric time

setAsymTime

public void setAsymTime(long asymTime)
Sets the asymmetric time

Parameters:
asymTime - the asymmetric time

getStatus

public Values getStatus()
Gets the link status

Returns:
the link status

compare

public int compare(LinkTuple l1,
                   LinkTuple l2)
Compares the components of two link tuples, to determine how they should be sorted

Specified by:
compare in interface java.util.Comparator<LinkTuple>
Parameters:
l1 - the first link tuple to compare
l2 - the first link tuple to compare
Returns:
-1 if l1 should be sorted before l2, 1 if l2 should be sorted before l1, or 0 if they are equal

equals

public boolean equals(LinkTuple tuple)
Compares the components of two link tuples, to determine if they are equal

Parameters:
tuple - the link tuple to compare with this link tuple
Returns:
true if all the components of the two link tuples are equal