Class BearerCapability.ITU_T.Layer1Capability.Details.ParityAndModem.Modem
- java.lang.Object
-
- com.opencloud.util.AbstractDataObject
-
- com.opencloud.util.AbstractFieldsObject
-
- AbstractEncodedDataObject<T>
-
- AbstractLazyEncodedDataObject<T>
-
- AbstractLazyEncodedNamedInteger<BearerCapability.ITU_T.Layer1Capability.Details.ParityAndModem.Modem.EncodedValue>
-
- com.opencloud.slee.resources.in.datatypes.cc.BearerCapability.ITU_T.Layer1Capability.Details.ParityAndModem.Modem
-
- All Implemented Interfaces:
DataObject
,Serializable
- Enclosing class:
- BearerCapability.ITU_T.Layer1Capability.Details.ParityAndModem
public static final class BearerCapability.ITU_T.Layer1Capability.Details.ParityAndModem.Modem extends AbstractLazyEncodedNamedInteger<BearerCapability.ITU_T.Layer1Capability.Details.ParityAndModem.Modem.EncodedValue>
Class Modem represents the DuplexMode and ModemType within a BearerCapability.ITU_T. It represents part of a larger octet string; it is not transmitted on a network by itself.The API offered by this class is as if the type were specified in ASN.1 as follows.
Modem ::= SEQUENCE { duplexMode DuplexMode, modemType ModemType }
The class takes care of encoding the field values into a NamedInteger and decoding field values from a NamedInteger, the encoded representation being as tabulated below.Data Encoding - based on ITU-T Q.931 (05/98) §4.5.5 p58 8 7 6 5 4 3 2 1 Octet 5d ext. 1 Duplex mode Modem type
The octet numbering in the above table is that used in the cited standard for the octet encoded here.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BearerCapability.ITU_T.Layer1Capability.Details.ParityAndModem.Modem.DuplexMode
Enumeration of ITU-T Duplex Mode constants.static class
BearerCapability.ITU_T.Layer1Capability.Details.ParityAndModem.Modem.EncodedValue
Representation of Modem values as NamedIntegers.static class
BearerCapability.ITU_T.Layer1Capability.Details.ParityAndModem.Modem.ModemType
ITU-T Modem Type constants.
-
Field Summary
-
Fields inherited from class com.opencloud.slee.resources.cgin.AbstractLazyEncodedDataObject
isDecoded
-
Fields inherited from class com.opencloud.slee.resources.cgin.AbstractEncodedDataObject
encoded
-
Fields inherited from class com.opencloud.util.AbstractFieldsObject
FIELD_ABSENT, FIELD_UNINITIALISED
-
-
Constructor Summary
Constructors Constructor Description Modem()
Constructs a new Modem object with no fields set.Modem(byte[] data)
Constructs a new Modem object from network-encoded data.Modem(byte[] data, int start, int len)
Constructs a new Modem object from part of network-encoded data.Modem(int arg)
Constructs a new Modem object from the given int, making it be read-only (immutable).Modem(BearerCapability.ITU_T.Layer1Capability.Details.ParityAndModem.Modem.DuplexMode duplexMode, BearerCapability.ITU_T.Layer1Capability.Details.ParityAndModem.Modem.ModemType modemType)
Constructs a new Modem object from given values for all fields.Modem(DataInput in)
Constructs a new Modem object from data deserialized from a stream that was written bytoStream(DataOutput)
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkFieldsSet()
Checks that all mandatory fields are present.BearerCapability.ITU_T.Layer1Capability.Details.ParityAndModem.Modem
clone()
Constructs a copy of this object and everything reachable from it.static BearerCapability.ITU_T.Layer1Capability.Details.ParityAndModem.Modem
copyOf(BearerCapability.ITU_T.Layer1Capability.Details.ParityAndModem.Modem from)
Creates a new object of this type, cloning the values of common fields from the given object of any subclass of the same base type.protected void
decode()
Computes the decoded form from the encoded form.protected void
encode()
Computes the encoded form from the decoded form.protected boolean
encodedIsInvalid()
Determines whether the encoded form is invalid.protected BearerCapability.ITU_T.Layer1Capability.Details.ParityAndModem.Modem.EncodedValue
fromValue(int value)
Converts an int to a NamedInteger.byte[]
getByteArrayForm()
Gets the byte array encoded form.BearerCapability.ITU_T.Layer1Capability.Details.ParityAndModem.Modem.DuplexMode
getDuplexMode()
Gets the value of half/full.BearerCapability.ITU_T.Layer1Capability.Details.ParityAndModem.Modem.EncodedValue
getEncodedForm()
Gets the encoded form.static FieldAccessor[]
getFieldAccessors()
Gets a new array of the accessors for fields of this type.Map<String,Object>
getFieldsMap(boolean withAbsents)
Gets a Map from field-name to field-value for the fields of a sequence.BearerCapability.ITU_T.Layer1Capability.Details.ParityAndModem.Modem.ModemType
getModemType()
Gets the value of the modem type.boolean
hasDuplexMode()
Tests whether the field DuplexMode has a value.boolean
hasModemType()
Tests whether the field ModemType has a value.BearerCapability.ITU_T.Layer1Capability.Details.ParityAndModem.Modem
setDuplexMode(BearerCapability.ITU_T.Layer1Capability.Details.ParityAndModem.Modem.DuplexMode value)
Sets the value of half/full.BearerCapability.ITU_T.Layer1Capability.Details.ParityAndModem.Modem
setModemType(BearerCapability.ITU_T.Layer1Capability.Details.ParityAndModem.Modem.ModemType value)
Sets the value of the modem type.void
toStream(DataOutput out)
Serializes this object to a stream in a form suitable for reading by {@link #BearerCapability.ITU_T.Layer1Capability.Details.ParityAndModem.Modem(DataInput)}.-
Methods inherited from class com.opencloud.slee.resources.cgin.AbstractLazyEncodedDataObject
checkDecode, checkModifyAndDecode
-
Methods inherited from class com.opencloud.util.AbstractFieldsObject
equals, hashCode, toString
-
Methods inherited from class com.opencloud.util.AbstractDataObject
checkModify, isReadOnly, setReadOnly
-
-
-
-
Constructor Detail
-
Modem
public Modem()
Constructs a new Modem object with no fields set.
-
Modem
public Modem(byte[] data)
Constructs a new Modem object from network-encoded data. The data is not decoded and might not be decodable.- Parameters:
data
- network-encoded data- Throws:
NullPointerException
- if data is null
-
Modem
public Modem(byte[] data, int start, int len)
Constructs a new Modem object from part of network-encoded data. The part starts at indexstart
and islen
bytes long. The data is not decoded and might not be decodable.- Parameters:
data
- network-encoded datastart
- starting offset of network-encoded data in byte arraylen
- default length if not predictable- Throws:
NullPointerException
- if data is nullIllegalArgumentException
- if len is negative
-
Modem
public Modem(BearerCapability.ITU_T.Layer1Capability.Details.ParityAndModem.Modem.DuplexMode duplexMode, BearerCapability.ITU_T.Layer1Capability.Details.ParityAndModem.Modem.ModemType modemType)
Constructs a new Modem object from given values for all fields.- Parameters:
duplexMode
- half/fullmodemType
- the modem type
-
Modem
public Modem(int arg)
Constructs a new Modem object from the given int, making it be read-only (immutable).- Parameters:
arg
- int
-
Modem
public Modem(DataInput in) throws IOException
Constructs a new Modem object from data deserialized from a stream that was written bytoStream(DataOutput)
.- Parameters:
in
- the stream to read from- Throws:
EOFException
- if reading is pre-empted by end-of-fileIOException
- if the data cannot be read
-
-
Method Detail
-
toStream
public void toStream(DataOutput out) throws IOException
Serializes this object to a stream in a form suitable for reading by {@link #BearerCapability.ITU_T.Layer1Capability.Details.ParityAndModem.Modem(DataInput)}.- Parameters:
out
- the stream to write to- Throws:
IOException
- if an I/O error occurs
-
hasDuplexMode
public boolean hasDuplexMode() throws DecodeException
Tests whether the field DuplexMode has a value.- Returns:
- whether the field has a value
- Throws:
DecodeException
- if encoded state cannot be decoded
-
hasModemType
public boolean hasModemType() throws DecodeException
Tests whether the field ModemType has a value.- Returns:
- whether the field has a value
- Throws:
DecodeException
- if encoded state cannot be decoded
-
checkFieldsSet
public void checkFieldsSet() throws EncodeException
Checks that all mandatory fields are present. Should be called immediately before all calls to encode().- Specified by:
checkFieldsSet
in classAbstractLazyEncodedDataObject<BearerCapability.ITU_T.Layer1Capability.Details.ParityAndModem.Modem.EncodedValue>
- Throws:
EncodeException
- if any mandatory field is not present
-
getDuplexMode
public BearerCapability.ITU_T.Layer1Capability.Details.ParityAndModem.Modem.DuplexMode getDuplexMode() throws DecodeException
Gets the value of half/full.- Returns:
- DuplexMode representation of half/full
- Throws:
DecodeException
- if encoded state cannot be decoded
-
getModemType
public BearerCapability.ITU_T.Layer1Capability.Details.ParityAndModem.Modem.ModemType getModemType() throws DecodeException
Gets the value of the modem type.- Returns:
- ModemType representation of the modem type
- Throws:
DecodeException
- if encoded state cannot be decoded
-
setDuplexMode
public BearerCapability.ITU_T.Layer1Capability.Details.ParityAndModem.Modem setDuplexMode(BearerCapability.ITU_T.Layer1Capability.Details.ParityAndModem.Modem.DuplexMode value) throws IllegalStateException
Sets the value of half/full.- Parameters:
value
- DuplexMode representation of half/full- Returns:
- this
- Throws:
IllegalStateException
-
setModemType
public BearerCapability.ITU_T.Layer1Capability.Details.ParityAndModem.Modem setModemType(BearerCapability.ITU_T.Layer1Capability.Details.ParityAndModem.Modem.ModemType value) throws IllegalStateException
Sets the value of the modem type.- Parameters:
value
- ModemType representation of the modem type- Returns:
- this
- Throws:
IllegalStateException
-
copyOf
public static BearerCapability.ITU_T.Layer1Capability.Details.ParityAndModem.Modem copyOf(BearerCapability.ITU_T.Layer1Capability.Details.ParityAndModem.Modem from)
Creates a new object of this type, cloning the values of common fields from the given object of any subclass of the same base type.- Parameters:
from
- the object from which to copy- Returns:
- Modem
-
clone
public BearerCapability.ITU_T.Layer1Capability.Details.ParityAndModem.Modem clone()
Constructs a copy of this object and everything reachable from it.- Specified by:
clone
in interfaceDataObject
- Specified by:
clone
in classAbstractDataObject
- Returns:
- copy of object
-
getFieldAccessors
public static FieldAccessor[] getFieldAccessors()
Gets a new array of the accessors for fields of this type.- Returns:
- FieldAccessor[]
-
getFieldsMap
public Map<String,Object> getFieldsMap(boolean withAbsents)
Gets a Map from field-name to field-value for the fields of a sequence. For a field of primitive type, the field-value is boxed. For an absent optional field, the field-value is AbstractFieldsObject.FIELD_ABSENT. For an uninitialised mandatory field, the field-value is AbstractFieldsObject.FIELD_UNINITIALISED. For a field of String type, the encoded form is used if the String cannot be decoded. For a type that represents an OCTET STRING that cannot be decoded, a map from "encodedValue" to the byte array value is returned.- Specified by:
getFieldsMap
in classAbstractFieldsObject
- Parameters:
withAbsents
- whether to put absent optional fields into Map- Returns:
- Map from field-name to field-value
-
encodedIsInvalid
protected boolean encodedIsInvalid()
Determines whether the encoded form is invalid.- Returns:
- boolean
-
getEncodedForm
public BearerCapability.ITU_T.Layer1Capability.Details.ParityAndModem.Modem.EncodedValue getEncodedForm() throws EncodeException
Gets the encoded form.- Returns:
- encoded form
- Throws:
EncodeException
- if encoding fails
-
getByteArrayForm
public byte[] getByteArrayForm() throws EncodeException
Gets the byte array encoded form. The size of the array is the least of 1, 2, 4, or 8 according to the type's bounds. The most significant byte of the numeric value is in the lowest indexed byte of the array.- Returns:
- byte array form
- Throws:
EncodeException
- if encoding fails
-
fromValue
protected BearerCapability.ITU_T.Layer1Capability.Details.ParityAndModem.Modem.EncodedValue fromValue(int value)
Converts an int to a NamedInteger. Reuses any existing instance where possible.- Specified by:
fromValue
in classAbstractLazyEncodedNamedInteger<BearerCapability.ITU_T.Layer1Capability.Details.ParityAndModem.Modem.EncodedValue>
- Parameters:
value
- int- Returns:
- NamedInteger
-
encode
protected void encode() throws EncodeException
Computes the encoded form from the decoded form.- Specified by:
encode
in classAbstractLazyEncodedDataObject<BearerCapability.ITU_T.Layer1Capability.Details.ParityAndModem.Modem.EncodedValue>
- Throws:
EncodeException
- if encoding fails
-
decode
protected void decode() throws DecodeException
Computes the decoded form from the encoded form.- Specified by:
decode
in classAbstractLazyEncodedDataObject<BearerCapability.ITU_T.Layer1Capability.Details.ParityAndModem.Modem.EncodedValue>
- Throws:
DecodeException
- if decoding fails
-
-