Package org.opengis.temporal

Examples of org.opengis.temporal.Instant


        String frameName = (String) node.getAttributeValue("frame", "#ISO-8601");
        NamedIdentifier frameID = new NamedIdentifier(Citations.CRS, frameName);
        TemporalReferenceSystem frame = new DefaultTemporalReferenceSystem(frameID, null);

        Instant begining = new DefaultInstant((Position) node.getChild("beginPosition").getValue());
        Instant ending = new DefaultInstant((Position) node.getChild("endPosition").getValue());

        Period timePeriod = new DefaultPeriod(begining, ending);

        return timePeriod;
    }
View Full Code Here


            return results;
        } else {
            List<Node> timePeriods = node.getChildren("timePeriod");
            if (timePeriods != null && !timePeriods.isEmpty()) {
                for (Node timePeriodNode : timePeriods) {
                    Instant begining = new DefaultInstant((Position) timePeriodNode.getChild("beginPosition").getValue());
                    Instant ending = new DefaultInstant((Position) timePeriodNode.getChild("endPosition").getValue());

                    //Period timePeriod = new DefaultPeriod(begining, ending);
                    TimePeriodType timePeriod = Wcs10Factory.eINSTANCE.createTimePeriodType();
                    TimePositionType beginPosition = Gml4wcsFactory.eINSTANCE.createTimePositionType();
                    TimePositionType endPosition = Gml4wcsFactory.eINSTANCE.createTimePositionType();
                   
                    beginPosition.setValue(begining.getPosition().getDate());
                    endPosition.setValue(ending.getPosition().getDate());
                   
                    timePeriod.setBeginPosition(beginPosition);
                    timePeriod.setEndPosition(endPosition);

                    results.getTimePeriod().add(timePeriod);
View Full Code Here

        CalendarDate referenceDate1 = new DefaultCalendarDate(frame1, IndeterminateValue.BEFORE, new SimpleInternationalString("Gregorian calendar"), calendarDate1);
        CalendarDate referenceDate2 = new DefaultCalendarDate(frame2, IndeterminateValue.NOW, new SimpleInternationalString("Babylonian calendar"), calendarDate2);
        JulianDate julianReference = new DefaultJulianDate(frame1, IndeterminateValue.NOW, 123456789);
       
        cal.set(1900, 0, 1);
        Instant begining1 = new DefaultInstant(new DefaultPosition(cal.getTime()));
        cal.set(2000, 9, 17);
        Instant ending1 = new DefaultInstant(new DefaultPosition(cal.getTime()));
        cal.set(2000, 1, 1);
        Instant begining2 = new DefaultInstant(new DefaultPosition(cal.getTime()));
        cal.set(2012, 1, 1);
        Instant ending2 = new DefaultInstant(new DefaultPosition(cal.getTime()));

        Period epochOfUse1 = new DefaultPeriod(begining1, ending1);
        Period epochOfUse2 = new DefaultPeriod(begining2, ending2);

        calendarEra1 = new DefaultCalendarEra(new SimpleInternationalString("Cenozoic"),
View Full Code Here

   
    return new DefaultPeriod(dateToInstant(firstDate),  dateToInstant(lastDate));
  }

  private static Period createPeriod(Date firstDate, Date lastDate) {
        Instant i1 = new DefaultInstant(new DefaultPosition(firstDate));
        Instant i2 = new DefaultInstant(new DefaultPosition(lastDate));
    return new DefaultPeriod(i1, i2);
  }
View Full Code Here

    } catch (ParseException e) {
      e.printStackTrace();
      throw e;
    }

        Instant instant = new DefaultInstant(new DefaultPosition(date));

        return instant;
    }
View Full Code Here

     * @param other TemporalPrimitive
     * @return
     */
    public RelativePosition relativePosition(TemporalPrimitive other) {
        if (this instanceof Instant && other instanceof Instant) {
            Instant timeobject = (Instant) this;
            Instant instantOther = (Instant) other;

            if (timeobject.getPosition().getDate().before(instantOther.getPosition().getDate())) {
                return RelativePosition.BEFORE;
            } else {
                return (timeobject.getPosition().getDate().compareTo(instantOther.getPosition().getDate()) == 0) ? RelativePosition.EQUALS : RelativePosition.AFTER;
            }

        } else {
            if (this instanceof Period && other instanceof Instant) {
                Period timeobject = (Period) this;
                Instant instantarg = (Instant) other;

                if (timeobject.getEnding().getPosition().getDate().before(instantarg.getPosition().getDate())) {
                    return RelativePosition.BEFORE;
                } else {
                    if (timeobject.getEnding().getPosition().getDate().compareTo(instantarg.getPosition().getDate()) == 0) {
                        return RelativePosition.ENDED_BY;
                    } else {
                        if (timeobject.getBeginning().getPosition().getDate().before(instantarg.getPosition().getDate()) &&
                                timeobject.getEnding().getPosition().getDate().after(instantarg.getPosition().getDate())) {
                            return RelativePosition.CONTAINS;
                        } else {
                            return (timeobject.getBeginning().getPosition().getDate().compareTo(instantarg.getPosition().getDate()) == 0) ? RelativePosition.BEGUN_BY : RelativePosition.AFTER;
                        }
                    }
                }
            } else {
                if (this instanceof Instant && other instanceof Period) {
                    Instant timeobject = (Instant) this;
                    Period instantarg = (Period) other;

                    if (instantarg.getEnding().getPosition().getDate().before(timeobject.getPosition().getDate())) {
                        return RelativePosition.AFTER;
                    } else {
                        if (instantarg.getEnding().getPosition().getDate().compareTo(timeobject.getPosition().getDate()) == 0) {
                            return RelativePosition.ENDS;
                        } else {
                            if (instantarg.getBeginning().getPosition().getDate().before(timeobject.getPosition().getDate()) &&
                                    instantarg.getEnding().getPosition().getDate().after(timeobject.getPosition().getDate())) {
                                return RelativePosition.DURING;
                            } else {
                                return (instantarg.getBeginning().getPosition().getDate().compareTo(timeobject.getPosition().getDate()) == 0) ? RelativePosition.BEGINS : RelativePosition.BEFORE;
                            }
                        }
                    }
                } else {
                    if (this instanceof Period && other instanceof Period) {
                        Period timeobject = (Period) this;
                        Period instantarg = (Period) other;

                        if (timeobject.getEnding().getPosition().getDate().before(instantarg.getBeginning().getPosition().getDate())) {
                            return RelativePosition.BEFORE;
                        } else {
                            if (timeobject.getEnding().getPosition().getDate().compareTo(instantarg.getBeginning().getPosition().getDate()) == 0) {
                                return RelativePosition.MEETS;
                            } else {
                                if (timeobject.getBeginning().getPosition().getDate().before(instantarg.getBeginning().getPosition().getDate()) &&
                                        timeobject.getEnding().getPosition().getDate().after(instantarg.getBeginning().getPosition().getDate()) &&
                                        timeobject.getEnding().getPosition().getDate().before(instantarg.getEnding().getPosition().getDate())) {
                                    return RelativePosition.OVERLAPS;
                                } else {
                                    if (timeobject.getBeginning().getPosition().getDate().compareTo(instantarg.getBeginning().getPosition().getDate()) == 0 &&
                                            timeobject.getEnding().getPosition().getDate().before(instantarg.getEnding().getPosition().getDate())) {
                                        return RelativePosition.BEGINS;
                                    } else {
                                        if (timeobject.getBeginning().getPosition().getDate().compareTo(instantarg.getBeginning().getPosition().getDate()) == 0 &&
                                                timeobject.getEnding().getPosition().getDate().after(instantarg.getEnding().getPosition().getDate())) {
                                            return RelativePosition.BEGUN_BY;
                                        } else {
                                            if (timeobject.getBeginning().getPosition().getDate().after(instantarg.getBeginning().getPosition().getDate()) &&
                                                    timeobject.getEnding().getPosition().getDate().before(instantarg.getEnding().getPosition().getDate())) {
                                                return RelativePosition.DURING;
                                            } else {
                                                if (timeobject.getBeginning().getPosition().getDate().before(instantarg.getBeginning().getPosition().getDate()) &&
                                                        timeobject.getEnding().getPosition().getDate().after(instantarg.getEnding().getPosition().getDate())) {
                                                    return RelativePosition.CONTAINS;
                                                } else {
                                                    if (timeobject.getBeginning().getPosition().getDate().compareTo(instantarg.getBeginning().getPosition().getDate()) == 0 &&
                                                            timeobject.getEnding().getPosition().getDate().compareTo(instantarg.getEnding().getPosition().getDate()) == 0) {
                                                        return RelativePosition.EQUALS;
                                                    } else {
                                                        if (timeobject.getBeginning().getPosition().getDate().after(instantarg.getBeginning().getPosition().getDate()) &&
                                                                timeobject.getBeginning().getPosition().getDate().before(instantarg.getEnding().getPosition().getDate()) &&
                                                                timeobject.getEnding().getPosition().getDate().after(instantarg.getEnding().getPosition().getDate())) {
                                                            return RelativePosition.OVERLAPPED_BY;
                                                        } else {
                                                            if (timeobject.getBeginning().getPosition().getDate().after(instantarg.getBeginning().getPosition().getDate()) &&
                                                                    timeobject.getEnding().getPosition().getDate().compareTo(instantarg.getEnding().getPosition().getDate()) == 0) {
                                                                return RelativePosition.ENDS;
                                                            } else {
                                                                if (timeobject.getBeginning().getPosition().getDate().before(instantarg.getBeginning().getPosition().getDate()) &&
                                                                        timeobject.getEnding().getPosition().getDate().compareTo(instantarg.getEnding().getPosition().getDate()) == 0) {
                                                                    return RelativePosition.ENDED_BY;
                                                                } else {
                                                                    return (timeobject.getBeginning().getPosition().getDate().compareTo(instantarg.getEnding().getPosition().getDate()) == 0) ? RelativePosition.MET_BY : RelativePosition.AFTER;
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
View Full Code Here

            if(Date.class == target) {
                return new Converter() {

                    @Override
                    public <T> T convert(Object source, Class<T> target) throws Exception {
                        Instant instant = (Instant) source;
                        return (T) instant.getPosition().getDate();
                    }
                   
                };
            }
        }
View Full Code Here

* @source $URL$
*/
public class BegunByImplTest extends TemporalFilterTestSupport {

    public void test() throws Exception {
        Instant i1 = instant("2001-07-05T12:08:56.235-0700");
        Instant i2 = instant("2001-07-04T12:08:56.235-0700");
        doAssert(i1, i2, false);
        doAssert(i2, i1, false);
        doAssert(i1, i1, false);
       
        Period p1 = period("2001-07-05T12:08:56.235-0700", "2001-07-06T12:08:56.235-0700");
View Full Code Here

* @source $URL$
*/
public class OverlappedByTest extends TemporalFilterTestSupport {

    public void test() throws Exception {
        Instant i1 = instant("2001-07-04T12:08:00.000-0700");
        Instant i2 = instant("2001-07-05T12:08:00.000-0700");
       
        doAssert(i1, i2, false);
        doAssert(i1, i1, false);
       
        Period p1 = period("2001-07-04T12:07:00.000-0700", "2001-07-05T12:08:00.000-0700");
View Full Code Here

* @source $URL$
*/
public class EndedByImplTest extends TemporalFilterTestSupport {

    public void test() throws Exception {
        Instant i1 = instant("2001-07-04T12:08:00.000-0700");
        Instant i2 = instant("2001-07-05T12:08:00.000-0700");
        doAssert(i1, i2, false);
        doAssert(i2, i1, false);
        doAssert(i1, i1, false);
       
        Period p1 = period("2001-07-04T12:07:00.000-0700", "2001-07-05T12:08:00.000-0700");
View Full Code Here

TOP

Related Classes of org.opengis.temporal.Instant

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.