|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectchtdecoder.datastructures.AbstractCHTCode
An abstract implementation of a CHTCode.
Constructor Summary | |
AbstractCHTCode()
|
Method Summary | |
static CHTCode |
createCHTCode(java.lang.String name,
int address,
int value,
boolean active)
A factory method for creating CHTCode objects. |
int |
getAddress()
Gets the address of this CHTCode. |
java.lang.String |
getName()
Gets the name of this CHTCode. |
int |
getValue()
Gets the value of this CHTCode. |
boolean |
isActive()
Asks if this CHTCode is active (turned ON). |
static CHTCode |
parseCHTCode(byte[] rawdata)
Parses a 28-byte raw CHT bitstring into a CHTCode. |
void |
setActive(boolean active)
Sets whether this CHTCode is active or not. |
void |
setAddress(int address)
Sets the address of this CHTCode. |
void |
setName(java.lang.String name)
Sets the name of this CHTCode (18 characters max). |
void |
setValue(int value)
Sets the value of this CHTCode. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public AbstractCHTCode()
Method Detail |
public static CHTCode createCHTCode(java.lang.String name, int address, int value, boolean active)
name
- The name of the CHTCode.address
- The address of the CHTCode.value
- The value of the CHTCode.active
- Whether this code is active or not.
public static CHTCode parseCHTCode(byte[] rawdata) throws InvalidCHTCodeDataException
rawdata
- The raw CHT bitstring.
InvalidCHTCodeDataException
- if the rawdata isn't a valid raw
CHT bitstring.public boolean isActive()
isActive
in interface CHTCode
public void setActive(boolean active)
setActive
in interface CHTCode
active
- true for active (ON); false for inactive (OFF).public int getAddress()
getAddress
in interface CHTCode
public void setAddress(int address) throws InvalidAddressException
setAddress
in interface CHTCode
address
- The address.
InvalidAddressException
- if the address is outside the range
0-16777215 (2^24 - 1).public int getValue()
getValue
in interface CHTCode
public void setValue(int value) throws InvalidValueException
setValue
in interface CHTCode
value
- The value.
InvalidValueException
- if the value is outside the range 0-255
(2^8 - 1).public java.lang.String getName()
getName
in interface CHTCode
public void setName(java.lang.String name) throws NameTooLongException
setName
in interface CHTCode
name
- The name.
NameTooLongException
- if the new name is longer than 18
characters.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |