hypercast.DT
Class DT_LogicalAddress

java.lang.Object
  |
  +--hypercast.DT.DT_Point
        |
        +--hypercast.DT.DT_LogicalAddress
All Implemented Interfaces:
I_Address, I_LogicalAddress

public final class DT_LogicalAddress
extends DT_Point
implements I_LogicalAddress

A logical address on the Delaunay triangulation. It extends DT_Point. It is immutable.


Field Summary
static int ADDRESS_ARRAY_SIZE
           
 
Constructor Summary
DT_LogicalAddress(byte[] array, int offset)
          Reads coordinates from a byte array.
DT_LogicalAddress(hypercast.DT.DT_LogicalAddress dtla)
           
DT_LogicalAddress(hypercast.INETv4OnePort a)
          Creates coordinate such that if 2 nodes are on the same network, they have close coordinates.
DT_LogicalAddress(int xx, int yy)
          constructor with the coodinates pair
DT_LogicalAddress(java.lang.String s)
          Reads coordinates from string in format "\d+,\d+".
 
Method Summary
 boolean equals(hypercast.I_Address a)
          Check if the given address is equal to this address.
 int getSize()
          Returns the size of byte[] used to store address.
 boolean greaterThan(hypercast.I_Address a)
          Implements method of I_Address interface.
 byte[] toByteArray()
          Converts the object into a byte array for transfer in a message.
 
Methods inherited from class hypercast.DT.DT_Point
angleRelative, angleToHorizon, distance, equals, findCenterOfCircle, getX, getY, greaterThan, hashCode, isInCircle, isInOrOnCircle, isOnCircle, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface hypercast.I_Address
equals, hashCode
 

Field Detail

ADDRESS_ARRAY_SIZE

public static final int ADDRESS_ARRAY_SIZE
See Also:
Constant Field Values
Constructor Detail

DT_LogicalAddress

public DT_LogicalAddress(int xx,
                         int yy)
constructor with the coodinates pair


DT_LogicalAddress

public DT_LogicalAddress(hypercast.DT.DT_LogicalAddress dtla)

DT_LogicalAddress

public DT_LogicalAddress(byte[] array,
                         int offset)
Reads coordinates from a byte array. It reads 8 bytes - the first 4 making the x-coordinate, the last 4 making the y-coordinate.


DT_LogicalAddress

public DT_LogicalAddress(java.lang.String s)
Reads coordinates from string in format "\d+,\d+". (e.g. "12345,67890")


DT_LogicalAddress

public DT_LogicalAddress(hypercast.INETv4OnePort a)
Creates coordinate such that if 2 nodes are on the same network, they have close coordinates. This is accomplished by taking every even-number bit in the IP_Address to make the x-coordinate, and every odd-numbered bit to make the y-coordinate. Note, implication does not go the other way. (i.e. if coordinates are close, it does not mean nodes are on the same network.)

Method Detail

greaterThan

public boolean greaterThan(hypercast.I_Address a)
Implements method of I_Address interface.

Specified by:
greaterThan in interface I_Address

equals

public boolean equals(hypercast.I_Address a)
Check if the given address is equal to this address.


getSize

public int getSize()
Returns the size of byte[] used to store address.

Specified by:
getSize in interface I_Address
Returns:
8

toByteArray

public byte[] toByteArray()
Converts the object into a byte array for transfer in a message. This is the exact inverse of the constructor that takes a byte array.

Specified by:
toByteArray in interface I_Address