Class MMCode
- java.lang.Object
-
- com.opencloud.util.AbstractDataObject
-
- com.opencloud.util.AbstractFieldsObject
-
- AbstractEncodedDataObject<T>
-
- AbstractLazyEncodedDataObject<T>
-
- AbstractLazyEncodedNamedInteger<MMCode.EncodedValue>
-
- com.opencloud.slee.resources.in.datatypes.map.MMCode
-
- All Implemented Interfaces:
DataObject
,FastSerializable
,Serializable
public final class MMCode extends AbstractLazyEncodedNamedInteger<MMCode.EncodedValue> implements FastSerializable
Class MMCode encapsulates a Mobility Management event. It represents the ASN.1 OCTET STRING type MAP-MS-DataTypes.MM-Code.The API offered by this class is as if the type were specified in ASN.1 as follows.
MMCode ::= SEQUENCE { encodedValue EncodedValue }
EncodedValue is a NamedInteger. For each named value of the type,
n
, the API defines three Java static fields: aDataObject n
, aNamedInteger EncodedValue.n
, and anint EncodedValue._n
.The encoding is based on comments in ASN.1 module MAP-MS-DataTypes in 3GPP TS 29.002 V10.0.0 (2010-09) p378.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MMCode.EncodedValue
MMCode constants.
-
Field Summary
Fields Modifier and Type Field Description static MMCode
GPRS_ATTACH
GPRS attachstatic MMCode
IMSI_ATTACH
IMSI attachstatic MMCode
LOCATION_UPDATE_IN_SAME_VLR
Location update in same VLRstatic MMCode
LOCATION_UPDATE_TO_OTHER_VLR
Location update to other VLRstatic MMCode
MS_INITIATED_GPRS_DETACH
MS initiated GPRS detachstatic MMCode
MS_INITIATED_IMSI_DETACH
MS initiated IMSI detachstatic MMCode
NETWORK_INITIATED_GPRS_DETACH
Network initiated GPRS detachstatic MMCode
NETWORK_INITIATED_IMSI_DETACH
Network initiated IMSI detachstatic MMCode
NETWORK_INITIATED_TRANSFER_TO_MS_NOT_REACHABLE_FOR_PAGING
Network initiated transfer toMS not reachable for pagingstatic MMCode
ROUTEING_AREA_UPDATE_IN_SAME_SGSN
Routeing (sic) area update in same SGSNstatic MMCode
ROUTEING_AREA_UPDATE_TO_OTHER_SGSN_DISCONNECT_BY_DETACH
Routeing (sic) area update to other SGSN disconnect by detachstatic MMCode
ROUTEING_AREA_UPDATE_TO_OTHER_SGSN_UPDATE_FROM_NEW_SGSN
Routeing (sic) area updateTo other SGSN update from new SGSN-
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 MMCode()
Constructs a new MMCode object with no fields set.MMCode(byte[] data)
Constructs a new MMCode object from network-encoded data.MMCode(byte[] data, int start, int len)
Constructs a new MMCode object from part of network-encoded data.MMCode(int arg)
Constructs a new MMCode object from the given int, making it be read-only (immutable).MMCode(MMCode.EncodedValue encodedValue)
Constructs a new MMCode object from given values for all fields.MMCode(DataInput in)
Constructs a new MMCode 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.MMCode
clone()
Constructs a copy of this object and everything reachable from it.static MMCode
copyOf(MMCode 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 MMCode.EncodedValue
fromValue(int value)
Converts an int to a NamedInteger.byte[]
getByteArrayForm()
Gets the byte array encoded form.MMCode.EncodedValue
getEncodedForm()
Gets the encoded form.MMCode.EncodedValue
getEncodedValue()
Gets the value of the MMCode value.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.boolean
hasEncodedValue()
Tests whether the field EncodedValue has a value.MMCode
setEncodedValue(MMCode.EncodedValue value)
Sets the value of the MMCode value.void
toStream(DataOutput out)
Serializes this object to a stream in a form suitable for reading byMMCode(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
-
-
-
-
Field Detail
-
LOCATION_UPDATE_IN_SAME_VLR
public static final MMCode LOCATION_UPDATE_IN_SAME_VLR
Location update in same VLR
-
LOCATION_UPDATE_TO_OTHER_VLR
public static final MMCode LOCATION_UPDATE_TO_OTHER_VLR
Location update to other VLR
-
IMSI_ATTACH
public static final MMCode IMSI_ATTACH
IMSI attach
-
MS_INITIATED_IMSI_DETACH
public static final MMCode MS_INITIATED_IMSI_DETACH
MS initiated IMSI detach
-
NETWORK_INITIATED_IMSI_DETACH
public static final MMCode NETWORK_INITIATED_IMSI_DETACH
Network initiated IMSI detach
-
ROUTEING_AREA_UPDATE_IN_SAME_SGSN
public static final MMCode ROUTEING_AREA_UPDATE_IN_SAME_SGSN
Routeing (sic) area update in same SGSN
-
ROUTEING_AREA_UPDATE_TO_OTHER_SGSN_UPDATE_FROM_NEW_SGSN
public static final MMCode ROUTEING_AREA_UPDATE_TO_OTHER_SGSN_UPDATE_FROM_NEW_SGSN
Routeing (sic) area updateTo other SGSN update from new SGSN
-
ROUTEING_AREA_UPDATE_TO_OTHER_SGSN_DISCONNECT_BY_DETACH
public static final MMCode ROUTEING_AREA_UPDATE_TO_OTHER_SGSN_DISCONNECT_BY_DETACH
Routeing (sic) area update to other SGSN disconnect by detach
-
GPRS_ATTACH
public static final MMCode GPRS_ATTACH
GPRS attach
-
MS_INITIATED_GPRS_DETACH
public static final MMCode MS_INITIATED_GPRS_DETACH
MS initiated GPRS detach
-
NETWORK_INITIATED_GPRS_DETACH
public static final MMCode NETWORK_INITIATED_GPRS_DETACH
Network initiated GPRS detach
-
NETWORK_INITIATED_TRANSFER_TO_MS_NOT_REACHABLE_FOR_PAGING
public static final MMCode NETWORK_INITIATED_TRANSFER_TO_MS_NOT_REACHABLE_FOR_PAGING
Network initiated transfer toMS not reachable for paging
-
-
Constructor Detail
-
MMCode
public MMCode()
Constructs a new MMCode object with no fields set.
-
MMCode
public MMCode(byte[] data)
Constructs a new MMCode 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
-
MMCode
public MMCode(byte[] data, int start, int len)
Constructs a new MMCode 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
-
MMCode
public MMCode(MMCode.EncodedValue encodedValue)
Constructs a new MMCode object from given values for all fields.- Parameters:
encodedValue
- the MMCode value
-
MMCode
public MMCode(int arg)
Constructs a new MMCode object from the given int, making it be read-only (immutable).- Parameters:
arg
- int
-
MMCode
public MMCode(DataInput in) throws IOException
Constructs a new MMCode 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 byMMCode(DataInput)
.- Specified by:
toStream
in interfaceFastSerializable
- Parameters:
out
- the stream to write to- Throws:
IOException
- if an I/O error occurs
-
hasEncodedValue
public boolean hasEncodedValue() throws DecodeException
Tests whether the field EncodedValue 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<MMCode.EncodedValue>
- Throws:
EncodeException
- if any mandatory field is not present
-
getEncodedValue
public MMCode.EncodedValue getEncodedValue() throws DecodeException
Gets the value of the MMCode value.- Returns:
- EncodedValue representation of the MMCode value
- Throws:
DecodeException
- if encoded state cannot be decoded
-
setEncodedValue
public MMCode setEncodedValue(MMCode.EncodedValue value) throws IllegalStateException
Sets the value of the MMCode value.- Parameters:
value
- EncodedValue representation of the MMCode value- Returns:
- this
- Throws:
IllegalStateException
-
copyOf
public static MMCode copyOf(MMCode 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:
- MMCode
-
clone
public MMCode 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 MMCode.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 MMCode.EncodedValue fromValue(int value)
Converts an int to a NamedInteger. Reuses any existing instance where possible.- Specified by:
fromValue
in classAbstractLazyEncodedNamedInteger<MMCode.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<MMCode.EncodedValue>
- Throws:
EncodeException
- if EncodedValue is not in range [0,255]
-
decode
protected void decode() throws DecodeException
Computes the decoded form from the encoded form.- Specified by:
decode
in classAbstractLazyEncodedDataObject<MMCode.EncodedValue>
- Throws:
DecodeException
- if decoding fails
-
-