public void setEnding(Date date) { this.ending = new DefaultInstant(new DefaultPosition(date)); }
public void setBegining(Date date) { this.begining = new DefaultInstant(new DefaultPosition(date)); }
public <T> T convert(Object source, Class<T> target) throws Exception { return (T) new DefaultInstant(new DefaultPosition((Date) source)); } };
/** * * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated modifiable */ public Object parse(ElementInstance instance, Node node, Object value) throws Exception { Position timePosition = new DefaultPosition(new SimpleInternationalString((String) value)); return timePosition; }
/** * * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated modifiable */ public Object parse(ElementInstance instance, Node node, Object value) throws Exception { Position timePosition = new DefaultPosition(new SimpleInternationalString((String) value)); return timePosition; }
@Before public void setUp() { Calendar cal = Calendar.getInstance(); cal.set(1981, 6, 25); position1 = new DefaultPosition(cal.getTime()); cal.set(2012, 0, 1); position2 = new DefaultPosition(cal.getTime()); }
@Before public void setUp() { Calendar cal = Calendar.getInstance(); cal.set(1995, 1, 1); Instant begining1 = new DefaultInstant(new DefaultPosition(cal.getTime())); cal.set(2000, 1, 1); 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())); period1 = new DefaultPeriod(begining1, ending1); period2 = new DefaultPeriod(begining2, ending2); }
protected Instant instant(String d) throws ParseException { return new DefaultInstant(new DefaultPosition(date(d))); }
@Before public void setUp() { cal.set(1981, 6, 25); Date date = cal.getTime(); Calendar c2 = Calendar.getInstance(); c2.set(2018, 4, 21); position1 = new DefaultPosition(date); position2 = new DefaultPosition(c2.getTime()); temporalGeomericPrimitive1 = new DefaultInstant(position1); temporalGeomericPrimitive2 = new DefaultInstant(position2); }
protected Instant instant(String d) throws ParseException { return new DefaultInstant(new DefaultPosition(date(d))); }
@Before public void setUp() { cal.set(1981, 6, 25); Date date = cal.getTime(); position1 = new DefaultPosition(date); position2 = new DefaultPosition(new Date()); temporalPrimitive1 = new DefaultInstant(position1); temporalPrimitive2 = new DefaultInstant(position2); }
@Before public void setUp() { cal.set(2000, 1, 1); position1 = new DefaultPosition(cal.getTime()); cal.set(1998, 1, 1); position2 = new DefaultPosition(cal.getTime()); instant1 = new DefaultInstant(position1); instant2 = new DefaultInstant(position2); }
/** Test of setEpochOfUse method, of class DefaultCalendarEra. */ @Test public void testSetEpochOfUse() { Period result = calendarEra1.getEpochOfUse(); cal.set(1900, 10, 10); ((DefaultCalendarEra) calendarEra1) .setEpochOfUse( new DefaultPeriod( new DefaultInstant(new DefaultPosition(cal.getTime())), new DefaultInstant(new DefaultPosition(new Date())))); assertFalse(calendarEra1.getEpochOfUse().equals(result)); }
/** Test of setEnding method, of class DefaultPeriod. */ @Test public void testSetEnding_Instant() { Instant result = period1.getEnding(); Instant newInstant = new DefaultInstant(new DefaultPosition(new Date())); ((DefaultPeriod) period1).setEnding(newInstant); assertFalse(period1.getEnding().equals(result)); }
/** Test of setBegining method, of class DefaultPeriod. */ @Test public void testSetBegining_Instant() { Instant result = period1.getBeginning(); Instant newInstant = new DefaultInstant(new DefaultPosition(new Date())); ((DefaultPeriod) period1).setBegining(newInstant); assertFalse(period1.getBeginning().equals(result)); }
public void testAfterInstant() throws Exception { Date date = convert("2002-12-03 10:00:00AM", Date.class); DefaultInstant instant = new DefaultInstant(new DefaultPosition(date)); Expression literal = filterFac.literal(instant); Expression prop = filterFac.property(timestampFType.getAttributeDescriptors().get(0).getLocalName()); PropertyIsEqualTo filter = filterFac.equals(prop, literal); encoder.setFeatureType(timestampFType); encoder.encode(filter); LOGGER.fine("testAttr is a Timestamp " + filter + " -> " + output.getBuffer().toString()); assertEquals(output.getBuffer().toString(), "WHERE testAttr = '2002-12-03 10:00:00.0'"); }
/** Test of setPosition method, of class DefaultInstant. */ @Test public void testSetPosition() { Position result = instant1.getPosition(); Position position = new DefaultPosition(new Date()); ((DefaultInstant) instant1).setPosition(position); assertFalse(instant1.getPosition().equals(result)); }
public Period popPeriod() throws CQLException { Result item = null; try { item = stack.pop(); PeriodNode periodNode = (PeriodNode) item.getBuilt(); Literal begin = periodNode.getBeginning(); Literal end = periodNode.getEnding(); Position ip1 = new DefaultPosition((Date) begin.getValue()); Position ip2 = new DefaultPosition((Date) end.getValue()); Period period = new DefaultPeriod(new DefaultInstant(ip1), new DefaultInstant(ip2)); return period; } catch (ClassCastException cce) { throw new CQLException("Expecting Period", item.getToken(), cce, this.cqlSource); } catch (EmptyStackException ese) { throw new CQLException("No items on stack"); } }
public void testCapabilities_BegunBy() throws ParseException { Capabilities capabilities = new Capabilities(); capabilities.addType(BegunBy.class); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS"); dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); Date date1 = dateFormat.parse("1970-07-19T01:02:03.456Z"); Instant temporalInstant = new DefaultInstant(new DefaultPosition(date1)); Date date2 = dateFormat.parse("1970-07-19T07:08:09.101Z"); Instant temporalInstant2 = new DefaultInstant(new DefaultPosition(date2)); Period period = new DefaultPeriod(temporalInstant, temporalInstant2); FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null); BegunBy filter = ff.begunBy(ff.literal(period), ff.property("dateAttr")); assertTrue("supports", capabilities.supports(filter)); assertTrue("fullySupports", capabilities.fullySupports(filter)); } }
/** Test of length method, of class DefaultTemporalGeometricPrimitive. */ @Test public void testLength() { cal.set(2020, 0, 1); temporalGeomericPrimitive1 = new DefaultPeriod(new DefaultInstant(position1), new DefaultInstant(position2)); temporalGeomericPrimitive2 = new DefaultPeriod( new DefaultInstant(position2), new DefaultInstant(new DefaultPosition(cal.getTime()))); Duration result = temporalGeomericPrimitive1.length(); assertFalse(temporalGeomericPrimitive2.length().equals(result)); }