/** * 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 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)); } }
/** * Commits all pending information under the metadata "acquisition" node (station, sensors, <i>etc</i>). * If there is no pending acquisition information, then invoking this method has no effect. * If new acquisition info are added after this method call, they will be stored in a new element. * * <p>This method does not need to be invoked unless a new "acquisition info" node, * separated from the previous one, is desired.</p> */ public final void newAcquisition() { if (platform != null) { addIfNotPresent(acquisition().getPlatforms(), platform); } if (acquisition != null) { addIfNotPresent(metadata().getAcquisitionInformation(), acquisition); acquisition = null; } }
/** * Commits all pending information under the metadata "acquisition" node (station, sensors, <i>etc</i>). * If there is no pending acquisition information, then invoking this method has no effect. * If new acquisition info are added after this method call, they will be stored in a new element. * * <p>This method does not need to be invoked unless a new "acquisition info" node, * separated from the previous one, is desired.</p> */ public final void newAcquisition() { if (platform != null) { addIfNotPresent(acquisition().getPlatforms(), platform); } if (acquisition != null) { addIfNotPresent(metadata().getAcquisitionInformation(), acquisition); acquisition = null; } }
/** * 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)); }