public interface ChannelAccessGraphicsEnum extends ChannelAccessAlarmEnum, ChannelAccessGraphicsOnlyValue<java.lang.Short>, ChannelAccessControlsValue<java.lang.Short>
Channel Access values that represents the
DBR_GR_ENUM
and
DBR_CTRL_ENUM
types. This type
stores enum states and provides information about the alarm status and enum
state labels. In its internal representation, an enum is just an unsigned
short integer. However, it is interpreted as a discrete state. In contrast to
other types, enum values do not provide additional information for controls
type so that the same data structure is used for it.
Due to technical limitations of the Java platform, the enum states are represented by signed integers. The Channel Access protocol, however, defines them as unsigned. Therefore, positive numbers in the Channel Access protocol might appear as negative numbers in this library and vice-versa.
This interface should not be implemented by user-defined classes. Code that
wants to create an instance implementing this interface should use the
methods provided by ChannelAccessValueFactory
instead.
Modifier and Type | Method and Description |
---|---|
ChannelAccessGraphicsEnum |
asReadOnlyValue()
Returns a read-only version of this value.
|
ChannelAccessGraphicsEnum |
clone()
Creates and returns a copy of this object.
|
java.nio.charset.Charset |
getCharset()
Returns the encoding that is used for converting Java
strings into raw (null-terminated) strings and vice-versa.
|
java.util.List<java.lang.String> |
getLabels()
Returns the enum state labels.
|
byte[] |
getRawLabels()
Returns the raw representation of the label strings.
|
void |
setLabels(java.util.Collection<java.lang.String> value)
Replaces this value's labels with the elements from the specified
collection.
|
void |
setRawLabels(byte[] rawLabels,
int numberOfLabels)
Updates the label strings using the specified raw representations.
|
getValue, setValue
getAlarmSeverity, getAlarmStatus, setAlarmSeverity, setAlarmStatus
equals, getGenericValueElement, getType, getValueSize, hashCode, isReadOnly, iterator, toString
java.util.List<java.lang.String> getLabels()
Returns the enum state labels. The list returned contains display labels
for up to 16 states. The actual number of labels used is internally
stored in the Channel Access data-type. In contrast to the
getRawLabels()
method, this method only returns the labels that
have been marked as usable. The list never contains null
elements.
Modifications to this list affect this value's labels. The labels raw representation is updated automatically. Therefore, this list may not be modified after this value has been passed to a different component.
If this is a read-only value, the list returned is read-only, too.
null
elements.getRawLabels()
,
getCharset()
void setLabels(java.util.Collection<java.lang.String> value)
Replaces this value's labels with the elements from the specified
collection. This has the same effect as calling clear()
followed by addAll(value)
on the list returned by
getLabels()
.
The string's raw representation is updated automatically. Strings that are truncated while being converted to their raw representation still maintain their original length in the list of element strings.
value
- collection of strings that should replace this value's
elements.java.lang.IllegalArgumentException
- if value
has more than 16 elements.java.lang.NullPointerException
- if value
is null
or contains
null
elements.java.lang.UnsupportedOperationException
- if this value is read-only (ChannelAccessValue.isReadOnly()
returns
true
).byte[] getRawLabels()
Returns the raw representation of the label strings. This an array of 16 * 26 (= 416) bytes. Each string in this array has exactly 26 bytes and is null-terminated. This means that the label string with the zero-based index i starts at an array index of i * 26.
The array returned is a copy so modifications to it will not affect this value.
null
).getLabels()
,
getCharset()
void setRawLabels(byte[] rawLabels, int numberOfLabels)
Updates the label strings using the specified raw representations. The size of the array passed must be exactly 16 * 26 (= 416) bytes.. Each sequence of 26 bytes is interpreted as one null-terminated string. The strings must be null-terminated, therefore the size of an individual string must not exceed 25 characters (not including the terminating null-byte).
The array is copied, thus subsequent modifications of the array will not
affect the labels of this value. The Java strings
returned
by getLabels()
are updated by converting the specified raw
strings using the specified encoding
.
rawLabels
- new raw representation of the label strings (never
null
). The size of the array must be 16 * 26
bytes and strings must be null terminated.numberOfLabels
- the number of labels that should be used. Must be a number
between 0 and 16.java.lang.IllegalArgumentException
- if the size of the array is not 416 bytes, if the individual
strings are not null terminated, or if
numberOfLabels
is negative or greater than 16.java.lang.UnsupportedOperationException
- if this value is read-only (ChannelAccessValue.isReadOnly()
returns
true
).setLabels(Collection)
,
getCharset()
java.nio.charset.Charset getCharset()
getCharset
in interface ChannelAccessGraphicsValue<java.lang.Short>
null
).ChannelAccessGraphicsEnum asReadOnlyValue()
Returns a read-only version of this value. If the value is read-only, this value is returned. Otherwise, a wrapped version of this value, that does not allow modifications is returned.
Please note that the read-only value is not a copy of this value, but just a wrapper around it. This means, that modifications of the wrapped value will result in modifications of the read-only value. Therefore it is bad practice to modify a value that has been used as the base for a read-only value, because code that still has a reference to the read-only value might not expect this change and thus fail unexpectedly.
asReadOnlyValue
in interface ChannelAccessAlarmEnum
asReadOnlyValue
in interface ChannelAccessAlarmValue<java.lang.Short>
asReadOnlyValue
in interface ChannelAccessControlsValue<java.lang.Short>
asReadOnlyValue
in interface ChannelAccessEnum
asReadOnlyValue
in interface ChannelAccessGettableValue<java.lang.Short>
asReadOnlyValue
in interface ChannelAccessGraphicsOnlyValue<java.lang.Short>
asReadOnlyValue
in interface ChannelAccessGraphicsValue<java.lang.Short>
asReadOnlyValue
in interface ChannelAccessValue<java.lang.Short>
null
).ChannelAccessGraphicsEnum clone()
Creates and returns a copy of this object. The object returned is completely independent from this object. This means that modifications to this object will not affect the returned object and vice-versa.
The object returned is guaranteed to be completely identical to this
object, including its type. This means that
x.clone().equals(x)
and
x.clone().getClass() == x.getClass()
are always
true
.
The returned value is guaranteed to allow write access, even if this value is read-only. This means that cloning a read-only value is a good way to get a writable copy.
clone
in interface ChannelAccessAlarmEnum
clone
in interface ChannelAccessAlarmValue<java.lang.Short>
clone
in interface ChannelAccessControlsValue<java.lang.Short>
clone
in interface ChannelAccessEnum
clone
in interface ChannelAccessGettableValue<java.lang.Short>
clone
in interface ChannelAccessGraphicsOnlyValue<java.lang.Short>
clone
in interface ChannelAccessGraphicsValue<java.lang.Short>
clone
in interface ChannelAccessValue<java.lang.Short>
Copyright © 2014–2019 aquenos GmbH. All rights reserved.