/** * Creates a platform object if it does not already exists, then returns it. * * @return the platform information (never {@code null}). */ private DefaultPlatform platform() { if (platform == null) { platform = new DefaultPlatform(); } return platform; }
/** * Invoked by JAXB at marshalling time for getting the actual metadata to write * inside the {@code <gmi:MI_Platform>} 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 DefaultPlatform getElement() { return DefaultPlatform.castOrCopy(metadata); }
/** * Sets the unique identification of the platform. * * @param newValue the new identifier value. */ public void setIdentifier(final Identifier newValue) { checkWritePermission(); identifiers = nonNullCollection(identifiers, Identifier.class); NonMarshalledAuthority.setMarshallable(identifiers, newValue); }
final DefaultPlatform platform = new DefaultPlatform(); final DefaultInstrument instrument = new DefaultInstrument(); platform .setIdentifier(platformID); instrument.setIdentifier(instrumentID); platformHash += Platform.class.hashCode(); platform.getInstruments().add(instrument); platformHash += instrumentHash + 31; assertEquals("Platform", Integer.valueOf(platformHash), hash(platform));
/** * Creates a metadata object having a cyclic association. The cycle is between * {@code platform.instrument} and {@code instrument.isMountedOn}. */ static DefaultAcquisitionInformation createCyclicMetadata() { final DefaultInstrument instrument = new DefaultInstrument(); instrument.setType(new SimpleInternationalString("An instrument type.")); final DefaultPlatform platform = new DefaultPlatform(); platform.setDescription(new SimpleInternationalString("A platform.")); instrument.setMountedOn(platform); platform.setInstruments(singleton(instrument)); final DefaultAcquisitionInformation acquisition = new DefaultAcquisitionInformation(); acquisition.setPlatforms(singleton(platform)); return acquisition; }
/** * Adds a platform on which instrument are installed. If a platform was already defined * with a different identifier, then a new platform instance will be created. * Storage location is: * * <ul> * <li>{@code metadata/acquisitionInformation/platform/identifier}</li> * </ul> * * @param authority identifiers the authority that define platform codes, or {@code null} if none. * @param identifier identifier of the platform to add, or {@code null} for no-operation. */ public final void addPlatform(final CharSequence authority, String identifier) { if (identifier != null && !(identifier = identifier.trim()).isEmpty()) { if (platform != null) { final Identifier current = platform.getIdentifier(); if (current != null) { if (identifier.equals(current.getCode())) { return; } acquisition().getPlatforms().add(platform); platform = null; } } platform().setIdentifier(sharedIdentifier(authority, identifier)); } }
/** * Adds an instrument or sensor on the platform. * Storage location is: * * <ul> * <li>{@code metadata/acquisitionInformation/platform/instrument/identifier}</li> * </ul> * * @param authority identifiers the authority that define instrument codes, or {@code null} if none. * @param identifier identifier of the sensor to add, or {@code null} for no-operation. */ public final void addInstrument(final CharSequence authority, String identifier) { if (identifier != null && !(identifier = identifier.trim()).isEmpty()) { final DefaultInstrument instrument = new DefaultInstrument(); instrument.setIdentifier(sharedIdentifier(authority, identifier)); addIfNotPresent(platform().getInstruments(), instrument); } }
/** * 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(Platform) */ public DefaultPlatform(final Platform object) { super(object); if (object != null) { citation = object.getCitation(); identifiers = singleton(object.getIdentifier(), Identifier.class); description = object.getDescription(); sponsors = copyCollection(object.getSponsors(), ResponsibleParty.class); instruments = copyCollection(object.getInstruments(), Instrument.class); } }
/** * Sets the source where information about the platform is described. * * @param newValue the new citation value. */ public void setCitation(final Citation newValue) { checkWritePermission(); citation = newValue; }
/** * Gets the instrument(s) mounted on a platform. * * @return instrument(s) mounted on a platform. */ @Override @XmlElement(name = "instrument", required = true) public Collection<Instrument> getInstruments() { return instruments = nonNullCollection(instruments, Instrument.class); }
/** * Adds a platform on which instrument are installed. If a platform was already defined * with a different identifier, then a new platform instance will be created. * Storage location is: * * <ul> * <li>{@code metadata/acquisitionInformation/platform/identifier}</li> * </ul> * * @param authority identifiers the authority that define platform codes, or {@code null} if none. * @param identifier identifier of the platform to add, or {@code null} for no-operation. */ public final void addPlatform(final CharSequence authority, String identifier) { if (identifier != null && !(identifier = identifier.trim()).isEmpty()) { if (platform != null) { final Identifier current = platform.getIdentifier(); if (current != null) { if (identifier.equals(current.getCode())) { return; } acquisition().getPlatforms().add(platform); platform = null; } } platform().setIdentifier(sharedIdentifier(authority, identifier)); } }
/** * Adds an instrument or sensor on the platform. * Storage location is: * * <ul> * <li>{@code metadata/acquisitionInformation/platform/instrument/identifier}</li> * </ul> * * @param authority identifiers the authority that define instrument codes, or {@code null} if none. * @param identifier identifier of the sensor to add, or {@code null} for no-operation. */ public final void addInstrument(final CharSequence authority, String identifier) { if (identifier != null && !(identifier = identifier.trim()).isEmpty()) { final DefaultInstrument instrument = new DefaultInstrument(); instrument.setIdentifier(sharedIdentifier(authority, identifier)); addIfNotPresent(platform().getInstruments(), instrument); } }
/** * 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(Platform) */ public DefaultPlatform(final Platform object) { super(object); if (object != null) { citation = object.getCitation(); identifiers = singleton(object.getIdentifier(), Identifier.class); description = object.getDescription(); sponsors = copyCollection(object.getSponsors(), ResponsibleParty.class); instruments = copyCollection(object.getInstruments(), Instrument.class); } }
/** * Sets the narrative description of the platform supporting the instrument. * * @param newValue the new description value. */ public void setDescription(final InternationalString newValue) { checkWritePermission(); description = newValue; }
/** * Gets the instrument(s) mounted on a platform. * * @return instrument(s) mounted on a platform. */ @Override @XmlElement(name = "instrument", required = true) public Collection<Instrument> getInstruments() { return instruments = nonNullCollection(instruments, Instrument.class); }
/** * Creates a platform object if it does not already exists, then returns it. * * @return the platform information (never {@code null}). */ private DefaultPlatform platform() { if (platform == null) { platform = new DefaultPlatform(); } return platform; }
/** * Tests the {@link MetadataStandard#equals(Object, Object, ComparisonMode)} method on an object * having cyclic associations. In absence of safety guard against infinite recursivity, this test * would produce {@link StackOverflowError}. */ @Test @DependsOnMethod("testEquals") public void testEqualsOnCyclicMetadata() { final DefaultAcquisitionInformation p1 = createCyclicMetadata(); final DefaultAcquisitionInformation p2 = createCyclicMetadata(); assertTrue("equals", p1.equals(p2)); final DefaultPlatform platform = (DefaultPlatform) getSingleton(p2.getPlatforms()); final DefaultInstrument instrument = (DefaultInstrument) getSingleton(platform.getInstruments()); instrument.setType(new SimpleInternationalString("An other instrument type.")); assertFalse("equals", p1.equals(p2)); }
/** * Sets the source where information about the platform is described. * * @param newValue the new citation value. */ public void setCitation(final Citation newValue) { checkWritePermission(citation); citation = newValue; }
/** * Returns the organization responsible for building, launch, or operation of the platform. * * <div class="warning"><b>Upcoming API change — generalization</b><br> * As of ISO 19115:2014, {@code ResponsibleParty} is replaced by the {@code Responsibility} parent interface. * This change will be tentatively applied in GeoAPI 4.0. * </div> * * @return organization responsible for building, launch, or operation of the platform. */ @Override @XmlElement(name = "sponsor") public Collection<ResponsibleParty> getSponsors() { return sponsors = nonNullCollection(sponsors, ResponsibleParty.class); }
/** * Invoked by JAXB at marshalling time for getting the actual metadata to write * inside the {@code <mac:MI_Platform>} 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 DefaultPlatform getElement() { return DefaultPlatform.castOrCopy(metadata); }