public class TLcdAIXM51MessageUtil extends Object
The following operations are supported:
Modifier and Type | Method and Description |
---|---|
static TLcdAIXM51AbstractAIXMMessage |
generateSnapshot(TLcdAIXM51AbstractAIXMMessage aMessage,
Calendar aCalendar)
Generates a message for which each feature has exactly one timeslice.
|
static TLcdAIXM51AbstractAIXMMessage |
generateSnapshot(TLcdAIXM51AbstractAIXMMessage aMessage,
Date aDate)
This method behaves the same way as
generateSnapshot(TLcdAIXM51AbstractAIXMMessage, Calendar) except that
it uses the first valid time zone found in the given message. |
static TLcdAIXM51AbstractAIXMMessage |
mergeUniqueFeatures(TLcdAIXM51AbstractAIXMMessage aMessage)
Looks up feature instances in
aMessage that have the same gml:identifier
and merges them into a single new feature, with the same gml:identifier . |
static void |
originalModelHasChangedSFCT(TLcdAIXM51AbstractAIXMMessage aOriginalMessage,
TLcdAIXM51AbstractAIXMMessage aSnapshotMessage)
Resets a snapshot message after the original message has changed.
|
static List<TLcdAIXM51AbstractAIXMMessage> |
separateFeatureTypes(TLcdAIXM51AbstractAIXMMessage aMessage)
Creates a list of messages by separating all the features found in
aMessage
based on their Class . |
static TLcdAIXM51AbstractAIXMMessage |
sortMessage(TLcdAIXM51AbstractAIXMMessage aMessage)
Sorts the list of timeslices for every feature found in
aMessage . |
static void |
updateSnapshotSFCT(TLcdAIXM51AbstractAIXMMessage aOriginalMessage,
Calendar aCalendar,
TLcdAIXM51AbstractAIXMMessage aSnapshotMessage)
Updates a previously created snapshot message.
|
static void |
updateSnapshotSFCT(TLcdAIXM51AbstractAIXMMessage aOriginalMessage,
Date aDate,
TLcdAIXM51AbstractAIXMMessage aSnapshotMessage)
This method behaves the same way as
updateSnapshotSFCT(TLcdAIXM51AbstractAIXMMessage, Calendar, TLcdAIXM51AbstractAIXMMessage)
except that it uses the first valid time zone found in the given message. |
public static List<TLcdAIXM51AbstractAIXMMessage> separateFeatureTypes(TLcdAIXM51AbstractAIXMMessage aMessage)
aMessage
based on their Class
. The newly generated messages refer
to the same feature instances as in aMessage
.
The new messages have the same type as aMessage
and a model descriptor of the type
TLcdAIXM51ModelDescriptor
. The model descriptor returns the type of feature
contained in the message through TLcdAIXM51ModelDescriptor#getFeatureTypes
.
The returned list of messages will be ordered according to the following list of feature types.
aMessage
- message containing features that will be separated.public static TLcdAIXM51AbstractAIXMMessage mergeUniqueFeatures(TLcdAIXM51AbstractAIXMMessage aMessage)
aMessage
that have the same gml:identifier
and merges them into a single new feature, with the same gml:identifier
.
The timeslices that belong to the same feature in aMessage
are copied to the corresponding feature in the resulting message.
aMessage
- A valid AIXM 5.1 message for which each feature has a gml:identifier
.TLcdAIXM51AbstractAIXMFeature
, and the
value of the gml:identifier
returned by TLcdAIXM51AbstractAIXMFeature#getIdentifier
is unique. That means no other element in ILcdModel.elements()
has the same identifier
The runtime type of the result is the same as the runtime type of aMessage
.IllegalArgumentException
- is thrown in case a feature is detected which has no identifier,
this avoids merging features that are actually not the same.public static TLcdAIXM51AbstractAIXMMessage sortMessage(TLcdAIXM51AbstractAIXMMessage aMessage)
aMessage
.
The ordering is derived from the AIXM 5.1 specification and works as follows:
Timeslices with a different interpretation are ordered according to the following rule:
Baseline < Permdelta < Tempdelta
Sequence numbers are being used for timeslices with the same interpretation, correction numbers
are used when the sequence numbers are equal. Numbers are also ordered using lesser then.
In theory, the AIXM 5.1 specification does not allow timeslices within a feature to be "equal" with
respect to these rules.aMessage
- a messageList
returned by
TLcdAIXM51AbstractAIXMFeature#getTimeSlice
will be ordered according to the rules
described above such that each element in the list will be lesser then any subsequent element
in the list.public static TLcdAIXM51AbstractAIXMMessage generateSnapshot(TLcdAIXM51AbstractAIXMMessage aMessage, Calendar aCalendar)
"SNAPSHOT"
. If a feature doesn't contain timeslices that
are valid at the given date, it is omitted from the resulting message.
The generated snapshot timeslices should be considered read-only; create a deep clone in case you want to modify the timeslice.
The specification requires that for every feature one valid baseline timeslice should be present. This method however still tries to generate a snapshot from the available data, but it can not be guaranteed that the result is correct, as specified by the AIXM 5.1 specification.
If one of the timeslices of a feature is already a snapshot timeslice valid at the given calendar's date, this snapshot timeslice is used in the resulting message, regardless of any other timeslices. This behavior is correct in case you have a feature which only contains snapshots, and no other type of timeslices. The specification does not prescribe how to merge snapshot timeslices with other types of timeslices that possibly conflict with the snapshots.
PREREQUISITE: This method assumes that aMessage
is a sorted message for which
every feature is unique.
aMessage
- message for which a message containing snapshots will be generated. Timeslices
should be sorted using sortMessage(TLcdAIXM51AbstractAIXMMessage)
, and should
only contain unique features (see mergeUniqueFeatures(TLcdAIXM51AbstractAIXMMessage)
).aCalendar
- calendar that indicates the date and the time zone at which the generated snapshots will be valid.null
.sortMessage(com.luciad.format.aixm51.model.abstractfeature.TLcdAIXM51AbstractAIXMMessage)
,
mergeUniqueFeatures(com.luciad.format.aixm51.model.abstractfeature.TLcdAIXM51AbstractAIXMMessage)
public static TLcdAIXM51AbstractAIXMMessage generateSnapshot(TLcdAIXM51AbstractAIXMMessage aMessage, Date aDate)
generateSnapshot(TLcdAIXM51AbstractAIXMMessage, Calendar)
except that
it uses the first valid time zone found in the given message. If no valid time zone is found, UTC will be used.aMessage
- message for which a message containing snapshots will be generated. Timeslices
should be sorted using sortMessage(TLcdAIXM51AbstractAIXMMessage)
, and should
only contain unique features (see mergeUniqueFeatures(TLcdAIXM51AbstractAIXMMessage)
).aDate
- date at which the generated snapshots will be valid.null
.sortMessage(com.luciad.format.aixm51.model.abstractfeature.TLcdAIXM51AbstractAIXMMessage)
,
mergeUniqueFeatures(com.luciad.format.aixm51.model.abstractfeature.TLcdAIXM51AbstractAIXMMessage)
public static void updateSnapshotSFCT(TLcdAIXM51AbstractAIXMMessage aOriginalMessage, Calendar aCalendar, TLcdAIXM51AbstractAIXMMessage aSnapshotMessage)
generateSnapshot
and
updateSnapshotSFCT
. This means that the result of the methods size()
and elementAt(int)
are invariant between calls to these methods.
If this can no longer be guaranteed, create a new snapshot message using generateSnapshot
or use originalModelHasChangedSFCT
to reset a snapshot message to be compatible
with the original message.
After updating the snapshot message, an event will be fired containing the changes in the message.
In case the number of elements in the snapshot message and the original message do not match, an exception
will be thrown, and the snapshot message will remain unchanged.
Other incompatible changes to the models will not be detected by this method to improve performance. This
might result in undetermined behavior if the snapshot message has not been notified of the change using
originalModelHasChangedSFCT
.aOriginalMessage
- the original message with which aSnapshotMessage
has been generated,
and which will be used to generate the updated snapshots.aCalendar
- calendar that indicates the date and the time zone at which the generated snapshots will be valid.aSnapshotMessage
- A snapshot message that has been created using generateSnapshot(TLcdAIXM51AbstractAIXMMessage, Calendar)
.
This message will be updated to contain a snapshot which is valid at the given calendar's date.IllegalArgumentException
- in case aSnapshotMessage does not match aOriginalMessagegenerateSnapshot(TLcdAIXM51AbstractAIXMMessage, java.util.Calendar)
,
originalModelHasChangedSFCT(TLcdAIXM51AbstractAIXMMessage, TLcdAIXM51AbstractAIXMMessage)
public static void updateSnapshotSFCT(TLcdAIXM51AbstractAIXMMessage aOriginalMessage, Date aDate, TLcdAIXM51AbstractAIXMMessage aSnapshotMessage)
updateSnapshotSFCT(TLcdAIXM51AbstractAIXMMessage, Calendar, TLcdAIXM51AbstractAIXMMessage)
except that it uses the first valid time zone found in the given message. If no valid time zone is found, UTC will be used.aOriginalMessage
- the original message with which aSnapshotMessage
has been generated,
and which will be used to generate the updated snapshots.aDate
- date at which the generated snapshots will be valid.aSnapshotMessage
- A snapshot message that has been created using generateSnapshot(TLcdAIXM51AbstractAIXMMessage, Date)
.
This message will be updated to contain a snapshot which is valid at the given date.IllegalArgumentException
- in case aSnapshotMessage does not match aOriginalMessagegenerateSnapshot(TLcdAIXM51AbstractAIXMMessage, java.util.Date)
,
originalModelHasChangedSFCT(TLcdAIXM51AbstractAIXMMessage, TLcdAIXM51AbstractAIXMMessage)
public static void originalModelHasChangedSFCT(TLcdAIXM51AbstractAIXMMessage aOriginalMessage, TLcdAIXM51AbstractAIXMMessage aSnapshotMessage)
updateSnapshotSFCT
will not fail.
This method will not preserve existing snapshots, nor create new snapshots.
The following changes on the original model require this method to be called:ILcdIntegerIndexedModel
interface.
TLcdAIXM51AbstractAIXMFeature
like the gml:identifier
aOriginalMessage
- message with which the snapshot message should match.aSnapshotMessage
- message which will be reset so that it can be used with updateSnapshotSFCT
updateSnapshotSFCT(TLcdAIXM51AbstractAIXMMessage, java.util.Date, TLcdAIXM51AbstractAIXMMessage)