/** * 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 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); }
/** * 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); } }
/** * 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); } }