|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Interface for the meaning of bitgroups in a bitpattern. By far the most common bitpattern will be an enumeration. If you are sure this is the only thing you will encounter, then methods
A bitpattern is an integer data word wich is seen as a composite structure. A bitpattern can contain one or more consecutive bitgroups and a bitgroup can contain one or more consecutive bits. A bitgroup is identified by firstBit and ends before the firstBit of the next group, if any. The value of a bitpattern is the value of the data word seen as an integer.
It must be possible to mask unimportant bits in the bitpattern (this treats them as if they were 0) but this is done transparantly by the implementation.
A bitgroup is defined by one or more records composed of:
A bitgroup is continuous if its bits are read as an integer value. A continuous group is defined by a single record with reference value=-1 (so that it will match no possible actual value) and the label indicates the meaning of the value. The label seen in conversions (on input or output) is in fact a concatenation: 'label=value', for instance: 'widget position=15'. This makes decoding of packed values easier.
A BitPatternDefinition object can be obtained with
DirectoryService#getBitPatternDefinition(patternName).
The patternName must be unique for the implementation.
Implementation with a local cache is recommended for efficiency.
Note: in the bit description, describe only interesting situations: if a bit=1 indicates a fault, then there should be a matching label, but an absence of the fault (here bit=0) should have no matching label.
General documentation in DirectoryService .
DirectoryService
,
DeviceProperty
,
DeviceMessage
,
cdev.dir.rdbms.RdbmsBitPatternDefinition
Field Summary | |
static char |
DEFAULT_SEPARATOR
Default separator (',') for concatenated labels. |
Method Summary | |
long[] |
convertToGroupValues(long value)
Converts a bitpattern to an array of group values. |
DeviceMessage |
convertToMessage(long value)
Converts a bitpattern to a DeviceMessage. |
java.lang.String |
convertToString(long value)
Converts a bitpattern to a label (for an enumeration), or a concatenation of labels for a more complex bitpattern. |
java.lang.String |
convertToString(long value,
char separator)
Converts a bitpattern to a string of concatenated labels. |
long |
convertToValue(java.lang.String label)
Converts a label, or a concatenation of labels separated by DEFAULT_SEPARATOR, to a value. |
long |
convertToValue(java.lang.String labelConcatenation,
char separator)
Converts a concatenation of labels, with given separator, to a value. |
int[] |
getFirstBits()
Gets array of firstBits for bitgroups. |
DeviceMessage[] |
getMessages(int firstBit)
Gets array of defined messages for bitgroup starting at firstBit |
boolean |
isEnumeration()
Returns true if this bitpattern definition is a simple enumeration |
boolean |
isThisLabel(long value,
java.lang.String label)
Return true if this bitpattern 'contains' the label |
Methods inherited from interface cdev.dir.DirectoryItem |
getDescription,
getInfo,
getInfoLines,
getInfoWidth,
getName,
getServiceName,
toString |
Field Detail |
public static final char DEFAULT_SEPARATOR
Method Detail |
public long[] convertToGroupValues(long value)
value
- the integer to be convertedpublic DeviceMessage convertToMessage(long value) throws NoSuchDataException
value
- the integer to be convertedpublic java.lang.String convertToString(long value) throws NoSuchDataException, TooManyValuesException
value
- the integer to be converted to stringpublic java.lang.String convertToString(long value, char separator) throws NoSuchDataException
value
- the integer to be convertedpublic long convertToValue(java.lang.String label) throws NoSuchDataException, TooManyValuesException
label
- the string to be converted to integerpublic long convertToValue(java.lang.String labelConcatenation, char separator) throws BadQueryException, NoSuchDataException
labels
- the strings to be be packed in the bitpatternpublic int[] getFirstBits()
public DeviceMessage[] getMessages(int firstBit) throws BadQueryException
firstBit
- the first bit of the bitgrouppublic boolean isEnumeration()
public boolean isThisLabel(long value, java.lang.String label)
value
- the value of the bitpattern seen as an integerlabel
- the presence of this label must be checked
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |