protected void validateTimezone(DayTimeDurationValue offset) throws XPathException {
   Duration tz = offset.duration;
   Number secs = tz.getField(DatatypeConstants.SECONDS);
   if (secs != null && ((BigDecimal) secs).compareTo(BigDecimal.valueOf(0)) != 0)
     throw new XPathException(
         "duration " + offset + " has fractional minutes so cannot be used as a timezone offset");
   if (!(tz.equals(tzLowerBound)
       || tz.equals(tzUpperBound)
       || (tz.isLongerThan(tzLowerBound) && tz.isShorterThan(tzUpperBound))))
     throw new XPathException("duration " + offset + " outside valid timezone offset range");
 }
예제 #2
0
 /**
  *
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  *
  * @generated
  */
 @Override
 public boolean eIsSet(int featureID) {
   switch (featureID) {
     case PresentationPackage.SHOW_SHAPE_TYPE__SOUND:
       return sound != null;
     case PresentationPackage.SHOW_SHAPE_TYPE__DELAY:
       return DELAY_EDEFAULT == null ? delay != null : !DELAY_EDEFAULT.equals(delay);
     case PresentationPackage.SHOW_SHAPE_TYPE__DIRECTION:
       return isSetDirection();
     case PresentationPackage.SHOW_SHAPE_TYPE__EFFECT:
       return isSetEffect();
     case PresentationPackage.SHOW_SHAPE_TYPE__PATH_ID:
       return PATH_ID_EDEFAULT == null ? pathId != null : !PATH_ID_EDEFAULT.equals(pathId);
     case PresentationPackage.SHOW_SHAPE_TYPE__SHAPE_ID:
       return SHAPE_ID_EDEFAULT == null ? shapeId != null : !SHAPE_ID_EDEFAULT.equals(shapeId);
     case PresentationPackage.SHOW_SHAPE_TYPE__SPEED:
       return isSetSpeed();
     case PresentationPackage.SHOW_SHAPE_TYPE__START_SCALE:
       return isSetStartScale();
   }
   return super.eIsSet(featureID);
 }
 /*
  * Test for compare() both durations valid and equal.
  */
 @Test(dataProvider = "equal-duration")
 public void checkDurationEqual(String lexRepresentation1, String lexRepresentation2) {
   Duration duration1 = datatypeFactory.newDuration(lexRepresentation1);
   Duration duration2 = datatypeFactory.newDuration(lexRepresentation2);
   assertTrue(duration1.equals(duration2));
 }