protected static RestrictedTimelineDatatype create(final RestrictedTimelineDatatype other, final List<ContinuousRealInterval> wzIntervals, final List<ContinuousRealInterval> nzIntervals) { return new RestrictedTimelineDatatype(other, wzIntervals, nzIntervals); }
final String msg = format("Attempt to constrain datatype (%s) with unsupported constraining facet ('%s' , '%s')", getDatatype(), facet, value); _logger.severe(msg); throw new InvalidConstrainingFacetException(msg, facet, value); if (value instanceof XMLGregorianCalendar) c = (XMLGregorianCalendar) value; if (c == null || !isValidValue(c)) final String msg = format("Attempt to constrain datatype (%s) using constraining facet ('%s') with an unsupported value ('%s')", getDatatype(), f, value); _logger.severe(msg); throw new InvalidConstrainingFacetException(msg, facet, value); upper = calendarToReal(c); inclusiveUpper = false; upper = calendarToReal(c); inclusiveUpper = true; lower = calendarToReal(c); inclusiveLower = false; upper = null; lower = calendarToReal(c); inclusiveLower = true; upper = null; wzRestriction = zoneShrink(nzRestriction); nzRestriction = zoneShrink(wzRestriction);
private static XMLGregorianCalendar dateTime(final String s) { return RestrictedTimelineDatatype.getDatatypeFactory().newXMLGregorianCalendar(s); }
@Override public boolean contains(final Object value) { if (value instanceof XMLGregorianCalendar) { final XMLGregorianCalendar c = (XMLGregorianCalendar) value; if (isValidValue(c)) { final Number n = calendarToReal(c); /* * TODO: This could be made more efficient by looking at how * each contained check fails (e.g., if intervals is sorted by * boundaries and n is not contained, but less than upper, there * is no need to look further). */ for (final ContinuousRealInterval i : c.getTimezone() == DatatypeConstants.FIELD_UNDEFINED ? _nzIntervals : _wzIntervals) if (i.contains(n)) return true; return false; } else return false; } else return false; }
if (c.getTimezone() == DatatypeConstants.FIELD_UNDEFINED) final Number n = calendarToReal(c); for (final Iterator<ContinuousRealInterval> it = revisedNz.iterator(); it.hasNext();) return _empty; else return create(this, _wzIntervals, revisedNz);
return create(this, revisedWz, revisedNz);
final int day = c.getDay() == DatatypeConstants.FIELD_UNDEFINED ? daysInMonth(yrPlusOne, month) - 1 : c.getDay() - 1; daySum += daysInMonth(yrPlusOne, m);
final String msg = format("Attempt to constrain datatype (%s) with unsupported constraining facet ('%s' , '%s')", getDatatype(), facet, value); _logger.severe(msg); throw new InvalidConstrainingFacetException(msg, facet, value); if (value instanceof XMLGregorianCalendar) c = (XMLGregorianCalendar) value; if (c == null || !isValidValue(c)) final String msg = format("Attempt to constrain datatype (%s) using constraining facet ('%s') with an unsupported value ('%s')", getDatatype(), f, value); _logger.severe(msg); throw new InvalidConstrainingFacetException(msg, facet, value); upper = calendarToReal(c); inclusiveUpper = false; upper = calendarToReal(c); inclusiveUpper = true; lower = calendarToReal(c); inclusiveLower = false; upper = null; lower = calendarToReal(c); inclusiveLower = true; upper = null; wzRestriction = zoneShrink(nzRestriction); nzRestriction = zoneShrink(wzRestriction);
@Override public Duration getValue(final ATermAppl literal) throws InvalidLiteralException { final String lexicalForm = getLexicalForm(literal); try { final Duration c = getDatatypeFactory().newDuration(lexicalForm); return c; } catch (final IllegalArgumentException e) { /* * newXMLGregorianCalendar will throw an IllegalArgumentException if * the lexical form is not one of the XML Schema datetime types */ throw new InvalidLiteralException(getName(), lexicalForm, e); } catch (final IllegalStateException e) { /* * getXMLSchemaType will throw an IllegalStateException if the * combination of fields set in the calendar object doesn't match * one of the XML Schema datetime types */ throw new InvalidLiteralException(getName(), lexicalForm, e); } }
@Override public boolean contains(final Object value) { if (value instanceof XMLGregorianCalendar) { final XMLGregorianCalendar c = (XMLGregorianCalendar) value; if (isValidValue(c)) { final Number n = calendarToReal(c); /* * TODO: This could be made more efficient by looking at how * each contained check fails (e.g., if intervals is sorted by * boundaries and n is not contained, but less than upper, there * is no need to look further). */ for (final ContinuousRealInterval i : c.getTimezone() == DatatypeConstants.FIELD_UNDEFINED ? _nzIntervals : _wzIntervals) if (i.contains(n)) return true; return false; } else return false; } else return false; }
if (c.getTimezone() == DatatypeConstants.FIELD_UNDEFINED) final Number n = calendarToReal(c); for (final Iterator<ContinuousRealInterval> it = revisedNz.iterator(); it.hasNext();) return _empty; else return create(this, _wzIntervals, revisedNz);
return create(this, revisedWz, revisedNz);
final int day = c.getDay() == DatatypeConstants.FIELD_UNDEFINED ? daysInMonth(yrPlusOne, month) - 1 : c.getDay() - 1; daySum += daysInMonth(yrPlusOne, m);
protected static RestrictedTimelineDatatype create(final RestrictedTimelineDatatype other, final List<ContinuousRealInterval> wzIntervals, final List<ContinuousRealInterval> nzIntervals) { return new RestrictedTimelineDatatype(other, wzIntervals, nzIntervals); }
@Override public Duration getValue(final ATermAppl literal) throws InvalidLiteralException { final String lexicalForm = getLexicalForm(literal); try { final Duration c = getDatatypeFactory().newDuration(lexicalForm); return c; } catch (final IllegalArgumentException e) { /* * newXMLGregorianCalendar will throw an IllegalArgumentException if * the lexical form is not one of the XML Schema datetime types */ throw new InvalidLiteralException(getName(), lexicalForm, e); } catch (final IllegalStateException e) { /* * getXMLSchemaType will throw an IllegalStateException if the * combination of fields set in the calendar object doesn't match * one of the XML Schema datetime types */ throw new InvalidLiteralException(getName(), lexicalForm, e); } }
return _empty; else return create(this, revisedWz, revisedNz);
private XSDDateTime() { super(ATermUtils.makeTermAppl(Namespaces.XSD + "dateTime"), DatatypeConstants.DATETIME); dataRange = new RestrictedTimelineDatatype(this, DatatypeConstants.DATETIME, false); }
@Override public XMLGregorianCalendar getValue(final ATermAppl literal) throws InvalidLiteralException { final String lexicalForm = getLexicalForm(literal); try { final XMLGregorianCalendar c = getDatatypeFactory().newXMLGregorianCalendar(lexicalForm); if (!_schemaType.equals(c.getXMLSchemaType())) throw new InvalidLiteralException(getName(), lexicalForm); return c; } catch (final IllegalArgumentException e) { /* * newXMLGregorianCalendar will throw an IllegalArgumentException if * the lexical form is not one of the XML Schema datetime types */ throw new InvalidLiteralException(getName(), lexicalForm, e); } catch (final IllegalStateException e) { /* * getXMLSchemaType will throw an IllegalStateException if the * combination of fields set in the calendar object doesn't match * one of the XML Schema datetime types */ throw new InvalidLiteralException(getName(), lexicalForm, e); } }
return _empty; else return create(this, revisedWz, revisedNz);
private XSDGYearMonth() { super(ATermUtils.makeTermAppl(Namespaces.XSD + "gYearMonth"), DatatypeConstants.GYEARMONTH); dataRange = new RestrictedTimelineDatatype(this, DatatypeConstants.GYEARMONTH, false); }