@Override public <T> T convert(Object source, Class<T> target) throws Exception { Instant instant = (Instant) source; return (T) instant.getPosition().getDate(); } };
/** * * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated modifiable */ public Object parse(InstanceComponent instance, Object value) throws Exception { IndeterminateValue timeValue = IndeterminateValue.valueOf((String) value); return timeValue; } }
/** * Returns the relative position that matches the given string, or returns a new one if none * match it. * * @param code The name of the code to fetch or to create. * @return A code matching the given name. */ public static RelativePosition valueOf(String code) { return valueOf(RelativePosition.class, code); } }
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); }
public Object getProperty(Object object, QName name) { Period timePeriod = (Period) object; if (timePeriod == null) { return null; } if (name.getLocalPart().equals("BeginPosition")) { return timePeriod.getBeginning().getPosition(); } if (name.getLocalPart().equals("EndPosition")) { return timePeriod.getEnding().getPosition(); } return null; } }
public static Date ordinalToDate(final OrdinalPosition ordinalPosition) { if (ordinalPosition == null) { return null; } final Calendar calendar = Calendar.getInstance(); if (ordinalPosition.getOrdinalPosition() != null) { Date beginEra = ordinalPosition.getOrdinalPosition().getBeginning(); Date endEra = ordinalPosition.getOrdinalPosition().getEnd(); Long middle = ((endEra.getTime() - beginEra.getTime()) / 2) + beginEra.getTime(); calendar.setTimeInMillis(middle); return calendar.getTime(); } else { return null; } }
public DefaultPeriod(Instant begining, Instant ending) { if (begining.relativePosition(ending).equals(RelativePosition.BEFORE)) { this.begining = begining; this.ending = ending; } /*if (((DefaultInstant) begining).getPosition().getDate().before(((DefaultInstant) ending).getPosition().getDate())) { this.begining = begining; this.ending = ending; } */ else { throw new IllegalArgumentException( "The temporal position of the beginning of the period must be less than (i.e. earlier than) the temporal position of the end of the period"); } }
/** Test of getIndeterminatePosition method, of class DefaultTemporalPosition. */ @Test public void testGetIndeterminatePosition() { IndeterminateValue result = temporalPosition1.getIndeterminatePosition(); assertFalse(temporalPosition2.getIndeterminatePosition().equals(result)); }
/** Returns the list of enumerations of the same kind than this enum. */ public RelativePosition[] family() { return values(); }
/** Returns the list of enumerations of the same kind than this enum. */ public IndeterminateValue[] family() { return values(); }
public boolean evaluate(Object object) { TemporalPrimitive left = toTemporal(object, e1); TemporalPrimitive right = toTemporal(object, e2); if (left == null || right == null) { return false; } RelativePosition pos = left.relativePosition(right); return pos != null && doEvaluate(pos); }
/** Test of getEndedBy method, of class DefaultInstant. */ @Test public void testGetEndedBy() { Collection<Period> result = instant1.getEndedBy(); assertEquals(instant2.getEndedBy(), result); }
/** Test of setEnding method, of class DefaultPeriod. */ @Test public void testSetEnding_Date() { Date result = period1.getEnding().getPosition().getDate(); ((DefaultPeriod) period1).setEnding(new Date()); assertFalse(period1.getEnding().getPosition().getDate().equals(result)); }
/** Test of setBegining method, of class DefaultPeriod. */ @Test public void testSetBegining_Date() { Date result = period1.getBeginning().getPosition().getDate(); ((DefaultPeriod) period1).setBegining(new Date()); assertFalse(period1.getBeginning().getPosition().getDate().equals(result)); }
public Object getProperty(Object object, QName name) { Period timePeriod = (Period) object; if (timePeriod == null) { return null; } if (name.getLocalPart().equals("beginPosition")) { return timePeriod.getBeginning().getPosition(); } if (name.getLocalPart().equals("endPosition")) { return timePeriod.getEnding().getPosition(); } return null; } }
/** Test of setIndeterminatePosition method, of class DefaultTemporalPosition. */ @Test public void testSetIndeterminatePosition() { IndeterminateValue result = temporalPosition1.getIndeterminatePosition(); ((DefaultTemporalPosition) temporalPosition1) .setIndeterminatePosition(IndeterminateValue.BEFORE); assertFalse(temporalPosition1.getIndeterminatePosition().equals(result)); }
/** * Returns the indeterminate value that matches the given string, or returns a new one if none * match it. * * @param code The name of the code to fetch or to create. * @return A code matching the given name. */ public static IndeterminateValue valueOf(String code) { return valueOf(IndeterminateValue.class, code); } }