This is an automated email from the ASF dual-hosted git repository. desruisseaux pushed a commit to branch geoapi-4.0 in repository https://gitbox.apache.org/repos/asf/sis.git
commit 06a582ccd049d5e3f54ef52ae5783a46392719a4 Author: Martin Desruisseaux <martin.desruisse...@geomatys.com> AuthorDate: Thu Jun 13 18:57:39 2024 +0200 Rename `TemporalUtilities` as `TemporalObjects`. --- .../test/org/apache/sis/filter/PeriodLiteral.java | 6 +++--- .../sis/metadata/iso/extent/DefaultTemporalExtent.java | 6 +++--- .../sis/metadata/iso/identification/DefaultUsage.java | 8 ++++---- .../sis/metadata/iso/lineage/DefaultProcessStep.java | 6 +++--- .../{TemporalUtilities.java => TemporalObjects.java} | 4 ++-- .../main/org/apache/sis/xml/bind/gml/TM_Primitive.java | 8 ++++---- .../org/apache/sis/temporal/DefaultInstantTest.java | 4 ++-- .../org/apache/sis/temporal/DefaultPeriodTest.java | 14 +++++++------- .../org/apache/sis/xml/bind/gml/TimePeriodTest.java | 18 +++++++++--------- .../main/org/apache/sis/cql/CQL.java | 2 +- 10 files changed, 38 insertions(+), 38 deletions(-) diff --git a/endorsed/src/org.apache.sis.feature/test/org/apache/sis/filter/PeriodLiteral.java b/endorsed/src/org.apache.sis.feature/test/org/apache/sis/filter/PeriodLiteral.java index beaa0746a2..f547361c23 100644 --- a/endorsed/src/org.apache.sis.feature/test/org/apache/sis/filter/PeriodLiteral.java +++ b/endorsed/src/org.apache.sis.feature/test/org/apache/sis/filter/PeriodLiteral.java @@ -18,7 +18,7 @@ package org.apache.sis.filter; import java.time.Instant; import java.io.Serializable; -import org.apache.sis.temporal.TemporalUtilities; +import org.apache.sis.temporal.TemporalObjects; // Specific to the geoapi-3.1 and geoapi-4.0 branches: import org.opengis.feature.Feature; @@ -59,7 +59,7 @@ final class PeriodLiteral implements Period, Literal<Feature,Period>, Serializab */ @Override public org.opengis.temporal.Instant getBeginning() { - return TemporalUtilities.createInstant(Instant.ofEpochMilli(begin)); + return TemporalObjects.createInstant(Instant.ofEpochMilli(begin)); } /** @@ -67,7 +67,7 @@ final class PeriodLiteral implements Period, Literal<Feature,Period>, Serializab */ @Override public org.opengis.temporal.Instant getEnding() { - return TemporalUtilities.createInstant(Instant.ofEpochMilli(end)); + return TemporalObjects.createInstant(Instant.ofEpochMilli(end)); } /** diff --git a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/extent/DefaultTemporalExtent.java b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/extent/DefaultTemporalExtent.java index 4539bf5493..4adaddf03d 100644 --- a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/extent/DefaultTemporalExtent.java +++ b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/extent/DefaultTemporalExtent.java @@ -31,7 +31,7 @@ import org.opengis.metadata.extent.SpatialTemporalExtent; import org.opengis.referencing.operation.TransformException; import org.apache.sis.metadata.iso.ISOMetadata; import org.apache.sis.metadata.privy.ReferencingServices; -import org.apache.sis.temporal.TemporalUtilities; +import org.apache.sis.temporal.TemporalObjects; import org.apache.sis.temporal.TemporalDate; import org.apache.sis.xml.NilObject; import org.apache.sis.xml.NilReason; @@ -102,7 +102,7 @@ public class DefaultTemporalExtent extends ISOMetadata implements TemporalExtent * @since 1.5 */ public DefaultTemporalExtent(final Temporal beginning, final Temporal ending) { - extent = TemporalUtilities.createPeriod(beginning, ending); + extent = TemporalObjects.createPeriod(beginning, ending); } /** @@ -265,7 +265,7 @@ public class DefaultTemporalExtent extends ISOMetadata implements TemporalExtent * @since 1.5 */ public void setBounds(final Temporal beginning, final Temporal ending) { - setExtent(TemporalUtilities.createPeriod(beginning, ending)); + setExtent(TemporalObjects.createPeriod(beginning, ending)); } /** diff --git a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/identification/DefaultUsage.java b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/identification/DefaultUsage.java index e3a0d20692..842b4ee063 100644 --- a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/identification/DefaultUsage.java +++ b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/identification/DefaultUsage.java @@ -34,7 +34,7 @@ import org.apache.sis.xml.privy.LegacyNamespaces; import org.apache.sis.metadata.TitleProperty; import org.apache.sis.metadata.iso.ISOMetadata; import org.apache.sis.metadata.internal.Dependencies; -import org.apache.sis.temporal.TemporalUtilities; +import org.apache.sis.temporal.TemporalObjects; import org.apache.sis.temporal.TemporalDate; import org.apache.sis.util.iso.Types; @@ -239,7 +239,7 @@ public class DefaultUsage extends ISOMetadata implements Usage { final Collection<TemporalPrimitive> usageDates = getUsageDates(); if (usageDates != null) { for (TemporalPrimitive t : usageDates) { - Date p = TemporalDate.toDate(TemporalUtilities.getInstant(t)); + Date p = TemporalDate.toDate(TemporalObjects.getInstant(t)); if (p != null) { return p; } @@ -258,7 +258,7 @@ public class DefaultUsage extends ISOMetadata implements Usage { */ @Deprecated(since="1.5") public void setUsageDate(final Date newValue) { - setUsageDates(newValue == null ? List.of() : List.of(TemporalUtilities.createInstant(TemporalDate.toTemporal(newValue)))); + setUsageDates(newValue == null ? List.of() : List.of(TemporalObjects.createInstant(TemporalDate.toTemporal(newValue)))); } /** @@ -296,7 +296,7 @@ public class DefaultUsage extends ISOMetadata implements Usage { * @since 1.5 */ public void addUsageDates(final Temporal beginning, final Temporal ending) { - TemporalPrimitive period = TemporalUtilities.createPeriod(beginning, ending); + TemporalPrimitive period = TemporalObjects.createPeriod(beginning, ending); if (period != null) { getUsageDates().add(period); } diff --git a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/lineage/DefaultProcessStep.java b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/lineage/DefaultProcessStep.java index 030509cdfe..d1b49d4ca5 100644 --- a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/lineage/DefaultProcessStep.java +++ b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/lineage/DefaultProcessStep.java @@ -37,7 +37,7 @@ import org.apache.sis.xml.bind.FilterByVersion; import org.apache.sis.xml.bind.gml.TM_Primitive; import org.apache.sis.xml.bind.metadata.MD_Scope; import org.apache.sis.xml.privy.LegacyNamespaces; -import org.apache.sis.temporal.TemporalUtilities; +import org.apache.sis.temporal.TemporalObjects; // Specific to the geoapi-3.1 and geoapi-4.0 branches: import org.opengis.metadata.maintenance.Scope; @@ -302,7 +302,7 @@ public class DefaultProcessStep extends ISOMetadata implements ProcessStep { @XmlElement(name = "dateTime", namespace = LegacyNamespaces.GMD) public Date getDate() { if (FilterByVersion.LEGACY_METADATA.accept()) { - Date date = TemporalUtilities.getAnyDate(getStepDateTime()); + Date date = TemporalObjects.getAnyDate(getStepDateTime()); if (date == null) { date = ProcessStep.super.getDate(); } @@ -320,7 +320,7 @@ public class DefaultProcessStep extends ISOMetadata implements ProcessStep { */ @Deprecated(since="1.0") public void setDate(final Date newValue) { - setStepDateTime(TemporalUtilities.createInstant(newValue == null ? null : newValue.toInstant())); + setStepDateTime(TemporalObjects.createInstant(newValue == null ? null : newValue.toInstant())); } /** diff --git a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/temporal/TemporalUtilities.java b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/temporal/TemporalObjects.java similarity index 98% rename from endorsed/src/org.apache.sis.metadata/main/org/apache/sis/temporal/TemporalUtilities.java rename to endorsed/src/org.apache.sis.metadata/main/org/apache/sis/temporal/TemporalObjects.java index e96f6c2220..9063280bb3 100644 --- a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/temporal/TemporalUtilities.java +++ b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/temporal/TemporalObjects.java @@ -34,11 +34,11 @@ import org.opengis.temporal.Period; * @author Martin Desruisseaux (Geomatys) * @author Guilhem Legal (Geomatys) */ -public final class TemporalUtilities { +public final class TemporalObjects { /** * Do not allow instantiation of this class. */ - private TemporalUtilities() { + private TemporalObjects() { } /** diff --git a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/xml/bind/gml/TM_Primitive.java b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/xml/bind/gml/TM_Primitive.java index 8b5eff28bc..4cd2880a96 100644 --- a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/xml/bind/gml/TM_Primitive.java +++ b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/xml/bind/gml/TM_Primitive.java @@ -23,7 +23,7 @@ import org.opengis.temporal.TemporalPrimitive; import org.apache.sis.xml.privy.XmlUtilities; import org.apache.sis.xml.bind.Context; import org.apache.sis.xml.bind.gco.PropertyType; -import org.apache.sis.temporal.TemporalUtilities; +import org.apache.sis.temporal.TemporalObjects; import org.apache.sis.util.resources.Errors; // Specific to the geoapi-3.1 and geoapi-4.0 branches: @@ -96,7 +96,7 @@ public class TM_Primitive extends PropertyType<TM_Primitive, TemporalPrimitive> */ @XmlElement(name = "TimeInstant") public final TimeInstant getTimeInstant() { - Temporal time = TemporalUtilities.getInstant(metadata); + Temporal time = TemporalObjects.getInstant(metadata); return (time != null) ? new TimeInstant(time) : null; } @@ -124,7 +124,7 @@ public class TM_Primitive extends PropertyType<TM_Primitive, TemporalPrimitive> Context.warningOccured(context, TemporalPrimitive.class, "setTimePeriod", Errors.class, Errors.Keys.IllegalRange_2, begin, end); } else { - metadata = TemporalUtilities.createPeriod(begin, end); + metadata = TemporalObjects.createPeriod(begin, end); period.copyIdTo(metadata); } } @@ -141,7 +141,7 @@ public class TM_Primitive extends PropertyType<TM_Primitive, TemporalPrimitive> if (instant != null) { final Temporal position = XmlUtilities.toTemporal(Context.current(), instant.timePosition); if (position != null) { - metadata = TemporalUtilities.createInstant(position); + metadata = TemporalObjects.createInstant(position); instant.copyIdTo(metadata); } } diff --git a/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/temporal/DefaultInstantTest.java b/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/temporal/DefaultInstantTest.java index dd8acb56e8..403defe9f3 100644 --- a/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/temporal/DefaultInstantTest.java +++ b/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/temporal/DefaultInstantTest.java @@ -51,12 +51,12 @@ public final class DefaultInstantTest extends TestCase { /** * Tests {@link DefaultInstant#getPosition()}. - * Opportunistically tests {@link TemporalUtilities#createInstant(Temporal)} too. + * Opportunistically tests {@link TemporalObjects#createInstant(Temporal)} too. */ @Test public void testGetPosition() { var date = LocalDate.of(2010, 5, 1); - var instant = TemporalUtilities.createInstant(date); + var instant = TemporalObjects.createInstant(date); assertEquals(date, instant.getPosition()); } diff --git a/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/temporal/DefaultPeriodTest.java b/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/temporal/DefaultPeriodTest.java index de37051758..f913813e03 100644 --- a/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/temporal/DefaultPeriodTest.java +++ b/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/temporal/DefaultPeriodTest.java @@ -40,13 +40,13 @@ public final class DefaultPeriodTest extends TestCase { /** * Tests {@link DefaultPeriod#getBeginning()} and {@link DefaultPeriod#getEnding()}. - * Opportunistically tests {@link TemporalUtilities#createPeriod(Temporal, Temporal)} too. + * Opportunistically tests {@link TemporalObjects#createPeriod(Temporal, Temporal)} too. */ @Test public void testBounds() { var beginning = LocalDate.of(2010, 5, 1); var ending = LocalDate.of(2015, 8, 6); - var period = TemporalUtilities.createPeriod(beginning, ending); + var period = TemporalObjects.createPeriod(beginning, ending); assertEquals(beginning, period.getBeginning().getPosition()); assertEquals(ending, period.getEnding().getPosition()); } @@ -56,9 +56,9 @@ public final class DefaultPeriodTest extends TestCase { */ @Test public void testEquals() { - var p1 = TemporalUtilities.createPeriod(LocalDate.of(2000, 1, 1), LocalDate.of(2010, 1, 1)); - var p2 = TemporalUtilities.createPeriod(LocalDate.of(1988, 1, 1), LocalDate.of(2010, 1, 1)); - var p3 = TemporalUtilities.createPeriod(LocalDate.of(1988, 1, 1), LocalDate.of(2010, 1, 1)); + var p1 = TemporalObjects.createPeriod(LocalDate.of(2000, 1, 1), LocalDate.of(2010, 1, 1)); + var p2 = TemporalObjects.createPeriod(LocalDate.of(1988, 1, 1), LocalDate.of(2010, 1, 1)); + var p3 = TemporalObjects.createPeriod(LocalDate.of(1988, 1, 1), LocalDate.of(2010, 1, 1)); assertNotEquals(p1, p2); assertNotEquals(p1.hashCode(), p2.hashCode()); @@ -72,7 +72,7 @@ public final class DefaultPeriodTest extends TestCase { */ @Test public void testToString() { - var p1 = TemporalUtilities.createPeriod(LocalDate.of(2000, 1, 1), LocalDate.of(2010, 1, 1)); + var p1 = TemporalObjects.createPeriod(LocalDate.of(2000, 1, 1), LocalDate.of(2010, 1, 1)); assertEquals("2000-01-01/2010-01-01", p1.toString()); } @@ -83,7 +83,7 @@ public final class DefaultPeriodTest extends TestCase { public void testLength() { var beginning = LocalDate.of(2010, 5, 1); var ending = LocalDate.of(2015, 8, 6); - var period = TemporalUtilities.createPeriod(beginning, ending); + var period = TemporalObjects.createPeriod(beginning, ending); assertEquals(Period.of(5, 3, 5), period.length()); } } diff --git a/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/xml/bind/gml/TimePeriodTest.java b/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/xml/bind/gml/TimePeriodTest.java index 9934516095..6c7a402e7d 100644 --- a/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/xml/bind/gml/TimePeriodTest.java +++ b/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/xml/bind/gml/TimePeriodTest.java @@ -30,7 +30,7 @@ import org.apache.sis.xml.XML; import org.apache.sis.xml.Namespaces; import org.apache.sis.xml.MarshallerPool; import org.apache.sis.xml.privy.XmlUtilities; -import org.apache.sis.temporal.TemporalUtilities; +import org.apache.sis.temporal.TemporalObjects; // Test dependencies import org.junit.jupiter.api.Test; @@ -109,8 +109,8 @@ public final class TimePeriodTest extends TestCase { @Test public void testPeriodGML2() throws JAXBException { createContext(); - final var begin = new TimePeriodBound.GML2(TemporalUtilities.createInstant(Instant.parse("1992-01-01T00:00:00Z"))); - final var end = new TimePeriodBound.GML2(TemporalUtilities.createInstant(Instant.parse("2007-12-31T00:00:00Z"))); + final var begin = new TimePeriodBound.GML2(TemporalObjects.createInstant(Instant.parse("1992-01-01T00:00:00Z"))); + final var end = new TimePeriodBound.GML2(TemporalObjects.createInstant(Instant.parse("2007-12-31T00:00:00Z"))); testPeriod(begin, end, "<gml:TimePeriod xmlns:gml=\"" + Namespaces.GML + "\">\n" + " <gml:begin>\n" + @@ -161,8 +161,8 @@ public final class TimePeriodTest extends TestCase { @Test public void testPeriodGML3() throws JAXBException { createContext(); - final var begin = new TimePeriodBound.GML3(TemporalUtilities.createInstant(Instant.parse("1992-01-01T00:00:00Z")), "before"); - final var end = new TimePeriodBound.GML3(TemporalUtilities.createInstant(Instant.parse("2007-12-31T00:00:00Z")), "after"); + final var begin = new TimePeriodBound.GML3(TemporalObjects.createInstant(Instant.parse("1992-01-01T00:00:00Z")), "before"); + final var end = new TimePeriodBound.GML3(TemporalObjects.createInstant(Instant.parse("2007-12-31T00:00:00Z")), "after"); testPeriod(begin, end, "<gml:TimePeriod xmlns:gml=\"" + Namespaces.GML + "\">\n" + " <gml:beginPosition>1992-01-01T01:00:00+01:00</gml:beginPosition>\n" + @@ -179,8 +179,8 @@ public final class TimePeriodTest extends TestCase { @Test public void testSimplifiedPeriodGML3() throws JAXBException { createContext(); - final var begin = new TimePeriodBound.GML3(TemporalUtilities.createInstant(LocalDate.of(1992, 1, 2)), "before"); - final var end = new TimePeriodBound.GML3(TemporalUtilities.createInstant(LocalDate.of(2007, 12, 31)), "after"); + final var begin = new TimePeriodBound.GML3(TemporalObjects.createInstant(LocalDate.of(1992, 1, 2)), "before"); + final var end = new TimePeriodBound.GML3(TemporalObjects.createInstant(LocalDate.of(2007, 12, 31)), "after"); testPeriod(begin, end, "<gml:TimePeriod xmlns:gml=\"" + Namespaces.GML + "\">\n" + " <gml:beginPosition>1992-01-02</gml:beginPosition>\n" + @@ -198,7 +198,7 @@ public final class TimePeriodTest extends TestCase { public void testBeforePeriodGML3() throws JAXBException { createContext(); final var begin = new TimePeriodBound.GML3(null, "before"); - final var end = new TimePeriodBound.GML3(TemporalUtilities.createInstant(LocalDate.of(2007, 12, 31)), "after"); + final var end = new TimePeriodBound.GML3(TemporalObjects.createInstant(LocalDate.of(2007, 12, 31)), "after"); testPeriod(begin, end, "<gml:TimePeriod xmlns:gml=\"" + Namespaces.GML + "\">\n" + " <gml:beginPosition indeterminatePosition=\"before\"/>\n" + @@ -215,7 +215,7 @@ public final class TimePeriodTest extends TestCase { @Test public void testAfterPeriodGML3() throws JAXBException { createContext(); - final var begin = new TimePeriodBound.GML3(TemporalUtilities.createInstant(LocalDate.of(1992, 1, 2)), "before"); + final var begin = new TimePeriodBound.GML3(TemporalObjects.createInstant(LocalDate.of(1992, 1, 2)), "before"); final var end = new TimePeriodBound.GML3(null, "after"); testPeriod(begin, end, "<gml:TimePeriod xmlns:gml=\"" + Namespaces.GML + "\">\n" + diff --git a/incubator/src/org.apache.sis.cql/main/org/apache/sis/cql/CQL.java b/incubator/src/org.apache.sis.cql/main/org/apache/sis/cql/CQL.java index 64fe0c1e02..d6096d76cf 100644 --- a/incubator/src/org.apache.sis.cql/main/org/apache/sis/cql/CQL.java +++ b/incubator/src/org.apache.sis.cql/main/org/apache/sis/cql/CQL.java @@ -286,7 +286,7 @@ public final class CQL { case DATE: { TemporalAccessor ta = LenientDateFormat.FORMAT.parse(tree.getText()); return ff.literal(ta); - // TODO! return ff.literal(TemporalUtilities.getTimeInMillis(tree.getText())); + // TODO: return ff.literal(TemporalObjects.getTimeInMillis(tree.getText())); } case TEXT: { // strip start and end '