@Override public <T> T convert(Object source, Class<T> target) throws Exception { Instant instant = (Instant) source; return (T) instant.getPosition().getDate(); } };
@Override public Element encode(Object object, Document document, Element value) throws Exception { Position timePosition = (Position) object; if (timePosition == null) { value.appendChild( document.createElementNS( GML.NAMESPACE, org.geotools.gml3.GML.Null.getLocalPart())); } value.appendChild(document.createTextNode(timePosition.getDateTime().toString())); return null; }
if (((Instant) this).getPosition().anyOther() != null && ((Instant) other).getPosition().anyOther() != null) { if (!((DefaultTemporalPosition) ((Instant) this).getPosition().anyOther()) .getFrame() .equals( ((DefaultTemporalPosition) ((Instant) other).getPosition().anyOther()) .getFrame())) { try { } else if (((Instant) this).getPosition().anyOther() != null) { if (((Instant) this).getPosition().anyOther().getIndeterminatePosition() != null || ((DefaultTemporalPosition) ((Instant) this).getPosition().anyOther()) .getFrame() instanceof OrdinalReferenceSystem) { } else if (((Instant) other).getPosition().anyOther() != null) { if (((Instant) other).getPosition().anyOther().getIndeterminatePosition() != null || ((DefaultTemporalPosition) ((Instant) other).getPosition().anyOther()) .getFrame() instanceof OrdinalReferenceSystem) { Math.min( Math.abs( ((Instant) other).getPosition().getDate().getTime() - ((Instant) this) .getPosition() .getDate() .getTime()),
DefaultInstant instant = new DefaultInstant(new DefaultPosition(cal.getTime())); t_originDate = instant.getPosition().getDateTime().toString(); } catch (ParseException e) { throw new IllegalArgumentException(e); NetCDFCRSUtilities.FACTORY_CONTAINER .getDatumFactory() .createTemporalDatum(datumMap, timeOrigin.getDate());
Date s = TemporalRange.START_TIME, e = TemporalRange.START_TIME; if (beginPosition.getDate() != null) { s = new Date(beginPosition.getDate().getTime() + 1); } else if (beginPosition.getTime() != null) { s = new Date(beginPosition.getTime().getTime() + 1); if (endPosition.getDate() != null) { e = new Date(endPosition.getDate().getTime() - 1); } else if (endPosition.getTime() != null) { e = new Date(endPosition.getTime().getTime() - 1); final Position beginPosition = ((Instant) data).getPosition(); Date s = TemporalRange.START_TIME; if (beginPosition.getDate() != null) { s = beginPosition.getDate(); } else if (beginPosition.getTime() != null) { s = beginPosition.getTime();
cal.setTime(epoch); DefaultInstant instant = new DefaultInstant(new DefaultPosition(cal.getTime())); t_originDate = instant.getPosition().getDateTime().toString(); } catch (ParseException e) { throw new IllegalArgumentException(e); final TemporalDatum temporalDatum = UnidataCRSUtilities.FACTORY_CONTAINER.getDatumFactory().createTemporalDatum(datumMap, timeOrigin.getDate());
out.write("'" + ts + "'"); } else if (literal instanceof Instant) { java.util.Date date = ((Instant) literal).getPosition().getDate(); Timestamp ts = new java.sql.Timestamp(date.getTime()); out.write("'" + ts + "'");
DefaultInstant instant = new DefaultInstant(new DefaultPosition(cal.getTime())); t_originDate = instant.getPosition().getDateTime().toString(); } catch (ParseException e) { throw new IllegalArgumentException(e); NetCDFCRSUtilities.FACTORY_CONTAINER .getDatumFactory() .createTemporalDatum(datumMap, timeOrigin.getDate());
if (((Instant) this).getPosition().anyOther() != null && ((Instant) other).getPosition().anyOther() != null) { if (!((DefaultTemporalPosition) ((Instant) this).getPosition().anyOther()).getFrame().equals(((DefaultTemporalPosition) ((Instant) other).getPosition().anyOther()).getFrame())) { try { throw new Exception("the TM_TemporalPositions are not both associated with the same TM_ReferenceSystem !"); } else if (((Instant) this).getPosition().anyOther() != null) { if (((Instant) this).getPosition().anyOther().getIndeterminatePosition() != null || ((DefaultTemporalPosition) ((Instant) this).getPosition().anyOther()).getFrame() instanceof OrdinalReferenceSystem) { try { throw new Exception("either of the two TM_TemporalPositions is indeterminate or is associated with a TM_OrdianlReferenceSystem !"); } else if (((Instant) other).getPosition().anyOther() != null) { if (((Instant) other).getPosition().anyOther().getIndeterminatePosition() != null || ((DefaultTemporalPosition) ((Instant) other).getPosition().anyOther()).getFrame() instanceof OrdinalReferenceSystem) { try { throw new Exception("either of the two TM_TemporalPositions is indeterminate or is associated with a TM_OrdianlReferenceSystem !"); diff = Math.min(Math.abs(((Instant) other).getPosition().getDate().getTime() - ((Instant) this).getPosition().getDate().getTime()), Math.abs(((Instant) this).getPosition().getDate().getTime() - ((Instant) other).getPosition().getDate().getTime())); } else { if (this instanceof Instant && other instanceof Period) { diff = Math.min(Math.abs(((Period) other).getBeginning().getPosition().getDate().getTime() - ((Instant) this).getPosition().getDate().getTime()), Math.abs(((Period) other).getEnding().getPosition().getDate().getTime() - ((Instant) this).getPosition().getDate().getTime())); } else { if (this instanceof Period && other instanceof Instant) { diff = Math.min(Math.abs(((Instant) other).getPosition().getDate().getTime() - ((Period) this).getEnding().getPosition().getDate().getTime()), Math.abs(((Instant) other).getPosition().getDate().getTime() - ((Period) this).getBeginning().getPosition().getDate().getTime())); } else { if (this instanceof Period && other instanceof Period) {
@Override public Element encode(Object object, Document document, Element value) throws Exception { Position timePosition = (Position) object; if (timePosition == null) { value.appendChild( document.createElementNS( GML.NAMESPACE, org.geotools.gml3.GML.Null.getLocalPart())); } value.appendChild(document.createTextNode(timePosition.getDateTime().toString())); return null; }
if (((Instant) this).getPosition().anyOther() != null && ((Instant) other).getPosition().anyOther() != null) { if (!((DefaultTemporalPosition) ((Instant) this).getPosition().anyOther()).getFrame().equals(((DefaultTemporalPosition) ((Instant) other).getPosition().anyOther()).getFrame())) { try { throw new Exception("the TM_TemporalPositions are not both associated with the same TM_ReferenceSystem !"); } else if (((Instant) this).getPosition().anyOther() != null) { if (((Instant) this).getPosition().anyOther().getIndeterminatePosition() != null || ((DefaultTemporalPosition) ((Instant) this).getPosition().anyOther()).getFrame() instanceof OrdinalReferenceSystem) { try { throw new Exception("either of the two TM_TemporalPositions is indeterminate or is associated with a TM_OrdianlReferenceSystem !"); } else if (((Instant) other).getPosition().anyOther() != null) { if (((Instant) other).getPosition().anyOther().getIndeterminatePosition() != null || ((DefaultTemporalPosition) ((Instant) other).getPosition().anyOther()).getFrame() instanceof OrdinalReferenceSystem) { try { throw new Exception("either of the two TM_TemporalPositions is indeterminate or is associated with a TM_OrdianlReferenceSystem !"); diff = Math.min(Math.abs(((Instant) other).getPosition().getDate().getTime() - ((Instant) this).getPosition().getDate().getTime()), Math.abs(((Instant) this).getPosition().getDate().getTime() - ((Instant) other).getPosition().getDate().getTime())); } else { if (this instanceof Instant && other instanceof Period) { diff = Math.min(Math.abs(((Period) other).getBeginning().getPosition().getDate().getTime() - ((Instant) this).getPosition().getDate().getTime()), Math.abs(((Period) other).getEnding().getPosition().getDate().getTime() - ((Instant) this).getPosition().getDate().getTime())); } else { if (this instanceof Period && other instanceof Instant) { diff = Math.min(Math.abs(((Instant) other).getPosition().getDate().getTime() - ((Period) this).getEnding().getPosition().getDate().getTime()), Math.abs(((Instant) other).getPosition().getDate().getTime() - ((Period) this).getBeginning().getPosition().getDate().getTime())); } else { if (this instanceof Period && other instanceof Period) {
/** Test of getDateTime method, of class DefaultPosition. */ @Test public void testGetDateTime() { InternationalString result = position1.getDateTime(); assertFalse(position2.getDateTime().equals(result)); }
void visitEnd(Period p, Object extraData) { filterFactory.literal(p.getEnding().getPosition().getDate()).accept(this, extraData); }
void visitBegin(Period p, Object extraData) { filterFactory.literal(p.getBeginning().getPosition().getDate()).accept(this, extraData); }
/** Test of equals method, of class DefaultInstant. */ @Test public void testEquals() { cal.set(2000, 1, 1); assertFalse(instant1.equals(null)); assertEquals(cal.getTime().getTime(), instant1.getPosition().getDate().getTime()); assertFalse(instant1.equals(instant2)); }
if (timeobject.getPosition().getDate().before(instantOther.getPosition().getDate())) { return RelativePosition.BEFORE; } else { return (timeobject .getPosition() .getDate() .compareTo(instantOther.getPosition().getDate()) == 0) ? RelativePosition.EQUALS .getEnding() .getPosition() .getDate() .before(instantarg.getPosition().getDate())) { return RelativePosition.BEFORE; } else { .getEnding() .getPosition() .getDate() .compareTo(instantarg.getPosition().getDate()) == 0) { return RelativePosition.ENDED_BY; .getBeginning() .getPosition() .getDate() .before(instantarg.getPosition().getDate()) && timeobject