Package org.opengis.temporal

Examples of org.opengis.temporal.Period


        assertEquals(1, features.size());
    }

    public void testEndedBy() throws Exception {
        init();
        Period period = period("2004-11-06 03:44:56", "2004-20-06 03:44:56");
        FilterFactory ff = dataStore.getFilterFactory();
        Filter f = ff.endedBy(ff.literal(period), ff.property("installed_tdt"));
        SimpleFeatureCollection features = featureSource.getFeatures(f);
        assertEquals(1, features.size());
    }
View Full Code Here


        assertEquals(1, features.size());
    }

    public void testDuring() throws Exception {
        init();
        Period period = period("2004-19-06 03:44:56", "2004-20-06 03:44:58");
        FilterFactory ff = dataStore.getFilterFactory();
        Filter f = ff.during(ff.property("installed_tdt"), ff.literal(period));
        SimpleFeatureCollection features = featureSource.getFeatures(f);
        assertEquals(1, features.size());
    }
View Full Code Here

        assertEquals(1, features.size());
    }

    public void testTContains() throws Exception {
        init();
        Period period = period("2004-19-06 03:44:56", "2004-20-06 03:44:58");
        FilterFactory ff = dataStore.getFilterFactory();
        Filter f = ff.tcontains(ff.literal(period), ff.property("installed_tdt"));
        SimpleFeatureCollection features = featureSource.getFeatures(f);
        assertEquals(1, features.size());
    }
View Full Code Here

            temp.append(literal.toString());
        } else if (literal instanceof Date) {
            temp.append("\"" + dateFormatUTC.format(literal) + "\"");
        } else if (literal instanceof Period) {
            if (filter instanceof After) {
                Period period = (Period) literal;
                temp.append(dateFormatUTC.format(period.getEnding().getPosition().getDate()));
            }
            if (filter instanceof Before || filter instanceof Begins || filter instanceof BegunBy) {
                Period period = (Period) literal;
                temp.append("\""
                        + dateFormatUTC.format(period.getBeginning().getPosition().getDate())
                        + "\"");
            }
            if (filter instanceof Ends || filter instanceof EndedBy) {
                Period period = (Period) literal;
                temp.append("\"" + dateFormatUTC.format(period.getEnding().getPosition().getDate())
                        + "\"");
            }
            if (filter instanceof During || filter instanceof TContains) {
                Period period = (Period) literal;
                temp.append("\""
                        + dateFormatUTC.format(period.getBeginning().getPosition().getDate())
                        + "\"");
                temp.append(" TO ");
                temp.append("\"" + dateFormatUTC.format(period.getEnding().getPosition().getDate())
                        + "\"");
            }
        } else {
            String escaped = FilterToSolr.escapeSpecialCharacters(literal.toString());
            escaped = "\"" + escaped + "\"";
View Full Code Here

    Filter after = ff.after(ff.property("date"), ff.literal(temporalInstant));

    // can also check of property is within a certain period
    Date date2 = FORMAT.parse("2001-07-04T12:08:56.235-0700");
    Instant temporalInstant2 = new DefaultInstant(new DefaultPosition(date2));
    Period period = new DefaultPeriod(temporalInstant, temporalInstant2);

    Filter within = ff.toverlaps(ff.property("constructed_date"),
            ff.literal(period));
    // temporal end
}
View Full Code Here

        After after = ff.after(ff.property(aname("dt")), ff.literal("2009-02-01 00:00:00"));
        assertDatesMatch(after, "2009-06-28 15:12:41", "2009-09-29 17:54:23");
    }

    public void testAfterInterval() throws Exception {
        Period period = period("2009-02-01 00:00:00", "2009-07-01 00:00:00");
       
        FilterFactory ff = dataStore.getFilterFactory();
       
        After after = ff.after(ff.property(aname("dt")), ff.literal(period));
        assertDatesMatch(after, "2009-09-29 17:54:23");
View Full Code Here

        Before before = ff.before(ff.property(aname("dt")), ff.literal("2009-02-01 00:00:00"));
        assertDatesMatch(before, "2009-01-15 13:10:12");
    }

    public void testBeforeInterval() throws Exception {
        Period period = period("2009-07-01 00:00:00", "2009-12-01 00:00:00");
       
        FilterFactory ff = dataStore.getFilterFactory();
       
        Before before = ff.before(ff.property(aname("dt")), ff.literal(period));
        assertDatesMatch(before, "2009-01-15 13:10:12", "2009-06-28 15:12:41");
View Full Code Here

        before = ff.before(ff.literal(period), ff.property(aname("dt")));
        assertDatesMatch(before, "2009-09-29 17:54:23");
    }

    public void testBegins() throws Exception {
        Period period = period("2009-01-15 13:10:12", "2009-06-28 15:12:41");
        FilterFactory ff = dataStore.getFilterFactory();
       
        Begins before = ff.begins(ff.property(aname("dt")), ff.literal(period));
        assertDatesMatch(before, "2009-01-15 13:10:12");
    }
View Full Code Here

        Begins before = ff.begins(ff.property(aname("dt")), ff.literal(period));
        assertDatesMatch(before, "2009-01-15 13:10:12");
    }

    public void testBegunBy() throws Exception {
        Period period = period("2009-01-15 13:10:12", "2009-06-28 15:12:41");
        FilterFactory ff = dataStore.getFilterFactory();
       
        BegunBy before = ff.begunBy(ff.literal(period), ff.property(aname("dt")));
        assertDatesMatch(before, "2009-01-15 13:10:12");
    }
View Full Code Here

        BegunBy before = ff.begunBy(ff.literal(period), ff.property(aname("dt")));
        assertDatesMatch(before, "2009-01-15 13:10:12");
    }
   
    public void testEnds() throws Exception {
        Period period = period("2009-01-15 13:10:12", "2009-06-28 15:12:41");
        FilterFactory ff = dataStore.getFilterFactory();
       
        Ends before = ff.ends(ff.property(aname("dt")), ff.literal(period));
        assertDatesMatch(before, "2009-06-28 15:12:41");
    }
View Full Code Here

TOP

Related Classes of org.opengis.temporal.Period

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.