/** * * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated modifiable */ public Object parse(ElementInstance instance, Node node, Object value) throws Exception { Position pos = (Position) node.getChildValue(Position.class); return new DefaultInstant(pos); } }
/** * Returns the length of this TM_GeometricPrimitive * * @return */ public Duration length() { Duration response = null; long diff = 0L; if (this instanceof Instant) { response = new DefaultPeriodDuration(Math.abs(diff)); return response; } else { if (this instanceof Period) { if (((Period) this).getBeginning() != null && ((Period) this).getEnding() != null) { response = ((DefaultInstant) ((Period) this).getBeginning()) .distance(((DefaultInstant) ((Period) this).getEnding())); return response; } } return null; } } }
cal.setTime(epoch); DefaultInstant instant = new DefaultInstant(new DefaultPosition(cal.getTime())); t_originDate = instant.getPosition().getDateTime().toString(); } catch (ParseException e) { throw new IllegalArgumentException(e);
GregorianCalendar cal = new GregorianCalendar(); cal.setTime(epoch); DefaultInstant instant = new DefaultInstant(new DefaultPosition(cal.getTime())); t_originDate = instant.getPosition().getDateTime().toString(); } catch (ParseException e) { throw new IllegalArgumentException(e);
public <T> T convert(Object source, Class<T> target) throws Exception { return (T) new DefaultInstant(new DefaultPosition((Date) source)); } };
cal.setTime(epoch); DefaultInstant instant = new DefaultInstant(new DefaultPosition(cal.getTime())); t_originDate = instant.getPosition().getDateTime().toString(); } catch (ParseException e) { throw new IllegalArgumentException(e);
/** * Returns the length of this TM_GeometricPrimitive * @return */ public Duration length() { Duration response = null; long diff = 0L; if (this instanceof Instant) { response = new DefaultPeriodDuration(Math.abs(diff)); return response; } else { if (this instanceof Period) { if (((Period) this).getBeginning() != null && ((Period) this).getEnding() != null) { response = ((DefaultInstant) ((Period) this).getBeginning()).distance(((DefaultInstant) ((Period) this).getEnding())); return response; } } return null; } } }
public void setEnding(Date date) { this.ending = new DefaultInstant(new DefaultPosition(date)); }
/** * Returns the length of this TM_GeometricPrimitive * @return */ public Duration length() { Duration response = null; long diff = 0L; if (this instanceof Instant) { response = new DefaultPeriodDuration(Math.abs(diff)); return response; } else { if (this instanceof Period) { if (((Period) this).getBeginning() != null && ((Period) this).getEnding() != null) { response = ((DefaultInstant) ((Period) this).getBeginning()).distance(((DefaultInstant) ((Period) this).getEnding())); return response; } } return null; } } }
public void setBegining(Date date) { this.begining = new DefaultInstant(new DefaultPosition(date)); }
/** * * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated modifiable */ public Object parse(ElementInstance instance, Node node, Object value) throws Exception { 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; }
/** * * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated modifiable */ public Object parse(ElementInstance instance, Node node, Object value) throws Exception { 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; }
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"); } }
/** 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)); }
@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); }
@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); }
} else { Position beginPosition = (Position) node.getChildValue("beginPosition"); begin = new DefaultInstant(beginPosition); } else { Position endPosition = (Position) node.getChildValue("endPosition"); end = new DefaultInstant(endPosition);
/** 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)); }