tuwien.auto.calimero
Class IndividualAddress

java.lang.Object
  extended by tuwien.auto.calimero.KNXAddress
      extended by tuwien.auto.calimero.IndividualAddress

public class IndividualAddress
extends KNXAddress

Represents an immutable KNX individual address.

An individual address is built up from 3 levels: area.line.device (4.4.8 bits) with separator of type '.' or '/'.
The sometimes used term "zone" is synonymous with "area".


Constructor Summary
IndividualAddress(byte[] address)
          Creates a KNX individual address from a byte array value.
IndividualAddress(int address)
          Creates a KNX individual address from a 16 Bit address value.
IndividualAddress(int area, int line, int device)
          Creates a KNX individual address from the 3-level notation area-, line- and device-address.
IndividualAddress(java.lang.String address)
          Creates a KNX individual address from a string address representation.
IndividualAddress(XMLReader r)
          Creates a KNX individual address from xml input.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Returns whether obj is equal to this KNX address type.
 byte getArea()
          Returns the area address.
 short getDevice()
          Returns the device address.
 byte getLine()
          Returns the line address.
 java.lang.String getType()
          Returns the KNX address type, identifying a group or individual address.
 int hashCode()
           
 java.lang.String toString()
          Returns the address as a string using the 3-level "area.line.device" notation.
 
Methods inherited from class tuwien.auto.calimero.KNXAddress
create, create, getRawAddress, save, toByteArray
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IndividualAddress

public IndividualAddress(byte[] address)
Creates a KNX individual address from a byte array value.

The address is read out of the first 2 byte fields, while the address array itself might be longer. The content of address is not modified.

Parameters:
address - the address byte array in big-endian format, with address.length > 1

IndividualAddress

public IndividualAddress(int address)
Creates a KNX individual address from a 16 Bit address value.

Parameters:
address - the address value in the range 0 <= value <= 0xFFFF

IndividualAddress

public IndividualAddress(int area,
                         int line,
                         int device)
Creates a KNX individual address from the 3-level notation area-, line- and device-address.

Parameters:
area - area address value, in the range 0 <= value <= 0xF
line - line address value, in the range 0 <= value <= 0xF
device - device address value, in the range 0 <= value <= 0xFF

IndividualAddress

public IndividualAddress(java.lang.String address)
                  throws KNXFormatException
Creates a KNX individual address from a string address representation.

The address consists of 3 levels (see class header specification). Allowed separators are '.' or '/', mutually exclusive.

Parameters:
address - string containing the KNX address
Throws:
KNXFormatException - on unknown address type, wrong address syntax, address values out of range, or wrong separator used

IndividualAddress

public IndividualAddress(XMLReader r)
                  throws KNXMLException
Creates a KNX individual address from xml input.

If the current XML element position is no start tag, the next element tag is read. The KNX address element is then expected to be the current element in the reader.

Parameters:
r - a XML reader
Throws:
KNXMLException - if the XML element is no KNXAddress or the address couldn't be read in correctly
Method Detail

equals

public boolean equals(java.lang.Object obj)
Returns whether obj is equal to this KNX address type.

Overrides:
equals in class java.lang.Object
Parameters:
obj - knx address object
Returns:
true iff obj is of this type and contains the same address, false otherwise

getArea

public final byte getArea()
Returns the area address.

The area address consists of the 4 most significant Bits in the address field.

Returns:
the area value (high nibble of the address high byte)

getDevice

public final short getDevice()
Returns the device address.

The device address consists of the low byte of the 16 Bit address field.

Returns:
the device value (8 least significant bits)

getLine

public final byte getLine()
Returns the line address.

The line address consists of 4 bits, starting with bit 8 to 11 in the address field.

Returns:
the line value (low nibble of the address high byte)

getType

public java.lang.String getType()
Description copied from class: KNXAddress
Returns the KNX address type, identifying a group or individual address.

Specified by:
getType in class KNXAddress
Returns:
address type as string

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Returns the address as a string using the 3-level "area.line.device" notation.

Overrides:
toString in class java.lang.Object
Returns:
the address string