/** * Returns a SIS metadata implementation with the values of the given arbitrary implementation. * This method performs the first applicable action in the following choices: * * <ul> * <li>If the given object is {@code null}, then this method returns {@code null}.</li> * <li>Otherwise if the given object is already an instance of * {@code DefaultEvent}, then it is returned unchanged.</li> * <li>Otherwise a new {@code DefaultEvent} instance is created using the * {@linkplain #DefaultEvent(Event) copy constructor} * and returned. Note that this is a <cite>shallow</cite> copy operation, since the other * metadata contained in the given object are not recursively copied.</li> * </ul> * * @param object the object to get as a SIS implementation, or {@code null} if none. * @return a SIS implementation containing the values of the given object (may be the * given object itself), or {@code null} if the argument was null. */ public static DefaultEvent castOrCopy(final Event object) { if (object == null || object instanceof DefaultEvent) { return (DefaultEvent) object; } return new DefaultEvent(object); }
/** * Invoked by JAXB at marshalling time for getting the actual metadata to write * inside the {@code <gmi:MI_Event>} XML element. * This is the value or a copy of the value given in argument to the {@code wrap} method. * * @return the metadata to be marshalled. */ @XmlElementRef public DefaultEvent getElement() { return DefaultEvent.castOrCopy(metadata); }
/** * Sets the relative time ordering of the event. * * @param newValue the new sequence value. */ public void setSequence(final Sequence newValue) { checkWritePermission(); sequence = newValue; }
/** * Adds an event that describe the time at which data were acquired. * Storage location is: * * <ul> * <li>{@code metadata/acquisitionInformation/operation/significantEvent/time}</li> * </ul> * * @param time the acquisition time, or {@code null} for no-operation. * * @see #addTemporalExtent(Date, Date) */ public final void addAcquisitionTime(final Date time) { if (time != null) { final DefaultEvent event = new DefaultEvent(); event.setContext(Context.ACQUISITION); event.setTime(time); final DefaultOperation op = new DefaultOperation(); op.setSignificantEvents(singleton(event)); op.setType(OperationType.REAL); op.setStatus(Progress.COMPLETED); addIfNotPresent(acquisition().getOperations(), op); } }
/** * Constructs a new instance initialized with the values from the specified metadata object. * This is a <cite>shallow</cite> copy constructor, since the other metadata contained in the * given object are not recursively copied. * * @param object the metadata to copy values from, or {@code null} if none. * * @see #castOrCopy(Event) */ public DefaultEvent(final Event object) { super(object); if (object != null) { identifiers = singleton(object.getIdentifier(), Identifier.class); trigger = object.getTrigger(); context = object.getContext(); sequence = object.getSequence(); time = toMilliseconds(object.getTime()); expectedObjectives = copyCollection(object.getExpectedObjectives(), Objective.class); relatedPass = object.getRelatedPass(); relatedSensors = copyCollection(object.getRelatedSensors(), Instrument.class); } }
/** * Sets the event name or number. * * @param newValue the event identifier value. */ public void setIdentifier(final Identifier newValue) { checkWritePermission(); identifiers = nonNullCollection(identifiers, Identifier.class); NonMarshalledAuthority.setMarshallable(identifiers, newValue); }
/** * Returns the instrument or instruments for which the event is meaningful. * * @return instruments for which the event is meaningful. */ @Override @XmlElement(name = "relatedSensor") public Collection<? extends Instrument> getRelatedSensors() { return relatedSensors = nonNullCollection(relatedSensors, Instrument.class); }
/** * Sets the instrument or instruments for which the event is meaningful. * * @param newValues the new instrument values. */ public void setRelatedSensors(final Collection<? extends Instrument> newValues) { relatedSensors = writeCollection(newValues, relatedSensors, Instrument.class); } }
/** * Adds an event that describe the time at which data were acquired. * Storage location is: * * <ul> * <li>{@code metadata/acquisitionInformation/operation/significantEvent/time}</li> * </ul> * * @param time the acquisition time, or {@code null} for no-operation. * * @see #addTemporalExtent(Date, Date) */ public final void addAcquisitionTime(final Date time) { if (time != null) { final DefaultEvent event = new DefaultEvent(); event.setContext(Context.ACQUISITION); event.setTime(time); final DefaultOperation op = new DefaultOperation(); op.setSignificantEvents(singleton(event)); op.setType(OperationType.REAL); op.setStatus(Progress.COMPLETED); addIfNotPresent(acquisition().getOperations(), op); } }
/** * Constructs a new instance initialized with the values from the specified metadata object. * This is a <cite>shallow</cite> copy constructor, since the other metadata contained in the * given object are not recursively copied. * * @param object the metadata to copy values from, or {@code null} if none. * * @see #castOrCopy(Event) */ public DefaultEvent(final Event object) { super(object); if (object != null) { identifiers = singleton(object.getIdentifier(), Identifier.class); trigger = object.getTrigger(); context = object.getContext(); sequence = object.getSequence(); time = toMilliseconds(object.getTime()); expectedObjectives = copyCollection(object.getExpectedObjectives(), Objective.class); relatedPass = object.getRelatedPass(); relatedSensors = copyCollection(object.getRelatedSensors(), Instrument.class); } }
/** * Returns the objective or objectives satisfied by an event. * * @return objectives satisfied by an event. */ @Override @XmlElement(name = "expectedObjective") public Collection<Objective> getExpectedObjectives() { return expectedObjectives = nonNullCollection(expectedObjectives, Objective.class); }
/** * Sets the objective or objectives satisfied by an event. * * @param newValues the new expected objectives values. */ public void setExpectedObjectives(final Collection<? extends Objective> newValues) { expectedObjectives = writeCollection(newValues, expectedObjectives, Objective.class); }
/** * Sets the initiator of the event. * * @param newValue the new trigger value. */ public void setTrigger(final Trigger newValue) { checkWritePermission(); trigger = newValue; }
/** * Returns a SIS metadata implementation with the values of the given arbitrary implementation. * This method performs the first applicable action in the following choices: * * <ul> * <li>If the given object is {@code null}, then this method returns {@code null}.</li> * <li>Otherwise if the given object is already an instance of * {@code DefaultEvent}, then it is returned unchanged.</li> * <li>Otherwise a new {@code DefaultEvent} instance is created using the * {@linkplain #DefaultEvent(Event) copy constructor} * and returned. Note that this is a <cite>shallow</cite> copy operation, since the other * metadata contained in the given object are not recursively copied.</li> * </ul> * * @param object the object to get as a SIS implementation, or {@code null} if none. * @return a SIS implementation containing the values of the given object (may be the * given object itself), or {@code null} if the argument was null. */ public static DefaultEvent castOrCopy(final Event object) { if (object == null || object instanceof DefaultEvent) { return (DefaultEvent) object; } return new DefaultEvent(object); }
/** * Returns the instrument or instruments for which the event is meaningful. * * @return instruments for which the event is meaningful. */ @Override @XmlElement(name = "relatedSensor") public Collection<? extends Instrument> getRelatedSensors() { return relatedSensors = nonNullCollection(relatedSensors, Instrument.class); }
/** * Sets the objective or objectives satisfied by an event. * * @param newValues the new expected objectives values. */ public void setExpectedObjectives(final Collection<? extends Objective> newValues) { expectedObjectives = writeCollection(newValues, expectedObjectives, Objective.class); }
/** * Invoked by JAXB at marshalling time for getting the actual metadata to write * inside the {@code <mac:MI_Event>} XML element. * This is the value or a copy of the value given in argument to the {@code wrap} method. * * @return the metadata to be marshalled. */ @XmlElementRef public DefaultEvent getElement() { return DefaultEvent.castOrCopy(metadata); }
/** * Sets the meaning of the event. * * @param newValue the new context value. */ public void setContext(final Context newValue) { checkWritePermission(); context = newValue; }
/** * Returns the objective or objectives satisfied by an event. * * @return objectives satisfied by an event. */ @Override @XmlElement(name = "expectedObjective") public Collection<Objective> getExpectedObjectives() { return expectedObjectives = nonNullCollection(expectedObjectives, Objective.class); }
/** * Sets the instrument or instruments for which the event is meaningful. * * @param newValues the new instrument values. */ public void setRelatedSensors(final Collection<? extends Instrument> newValues) { relatedSensors = writeCollection(newValues, relatedSensors, Instrument.class); } }