DbStorage
Class DbUnitAddress

java.lang.Object
  extended bystorage.UnitAddress
      extended byDbStorage.DbUnitAddress
Direct Known Subclasses:
PhysicalID

public class DbUnitAddress
extends storage.UnitAddress

A DbUnitAddress represents a unit address adapted for its storage and representation in semistructured database structures.


Field Summary
static DbUnitAddress NULL
          Represents a NULL (invalid) unit address.
static int SIZE
          The size in bytes of a DbUnitAddress.
 
Constructor Summary
DbUnitAddress()
          Constructs a NULL unit address.
DbUnitAddress(byte[] b, int off)
          Contructs a unit address from its binary representation .
DbUnitAddress(int spaceNumber, long unitNumber)
          Constructs a unit address whith specified space and unit numbers.
 
Method Summary
 void copyFrom(DbUnitAddress source)
          Copies the content of a unit address in this one.
 boolean equals(DbUnitAddress addr)
          Checks if this unit address is equals to other one.
 byte[] getContent()
          Returns the binary representation of this unit address.
 int getSpaceNumber()
          Returns the space number of this unit address.
 long getUnitNumber()
          Returns the unit number of this unit address.
 boolean isNull()
          Checks if a unit address has a NULL value.
 void set(byte[] b, int off)
          Sets a unit address from its binary representation .
 void set(int spaceNumber, long unitNumber)
          Sets the space and unit number of the unit address.
 void setNull()
          Sets this unit address as NULL.
 
Methods inherited from class storage.UnitAddress
equals
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SIZE

public static final int SIZE
The size in bytes of a DbUnitAddress.

See Also:
Constant Field Values

NULL

public static final DbUnitAddress NULL
Represents a NULL (invalid) unit address.

Constructor Detail

DbUnitAddress

public DbUnitAddress()
Constructs a NULL unit address.


DbUnitAddress

public DbUnitAddress(int spaceNumber,
                     long unitNumber)
Constructs a unit address whith specified space and unit numbers.

Parameters:
spaceNumber - The space number of the unit address.
unitNumber - The unit number of the unit address.

DbUnitAddress

public DbUnitAddress(byte[] b,
                     int off)
Contructs a unit address from its binary representation .

Parameters:
b - The byte array from which the binary representation is got.
off - The position of b from which the binary representation starts.
Method Detail

getSpaceNumber

public int getSpaceNumber()
Returns the space number of this unit address.

Returns:
The space number.

getUnitNumber

public long getUnitNumber()
Returns the unit number of this unit address.

Returns:
The unit number.

set

public void set(int spaceNumber,
                long unitNumber)
Sets the space and unit number of the unit address.

Parameters:
spaceNumber - The space number.
unitNumber - The unit number.

set

public void set(byte[] b,
                int off)
Sets a unit address from its binary representation .

Parameters:
b - The byte array from which the binary representation is got.
off - The position of b from which the binary representation starts.

copyFrom

public void copyFrom(DbUnitAddress source)
Copies the content of a unit address in this one.

Parameters:
source - The unit address to copy.

setNull

public void setNull()
Sets this unit address as NULL.


isNull

public boolean isNull()
Checks if a unit address has a NULL value.

Returns:
true if this unit address is NULL, false otherwise.

getContent

public byte[] getContent()
Returns the binary representation of this unit address.

Returns:
A byte array where the binary representation is.

equals

public boolean equals(DbUnitAddress addr)
Checks if this unit address is equals to other one.

Parameters:
addr - The unit address to compare.