use of javax.xml.datatype.Duration in project webtools.sourceediting by eclipse.
the class XSDateTime method minusXSDayTimeDuration.
private ResultSequence minusXSDayTimeDuration(Item at) {
XSDuration val = (XSDuration) at;
try {
XSDateTime res = (XSDateTime) clone();
XMLGregorianCalendar xmlCal = _datatypeFactory.newXMLGregorianCalendar((GregorianCalendar) calendar());
Duration dtduration = _datatypeFactory.newDuration(val.getStringValue());
xmlCal.add(dtduration.negate());
res = new XSDateTime(xmlCal.toGregorianCalendar(), res.tz());
return ResultSequenceFactory.create_new(res);
} catch (CloneNotSupportedException ex) {
}
return null;
}
use of javax.xml.datatype.Duration in project webtools.sourceediting by eclipse.
the class XSDateTime method minusXSDateTime.
private ResultSequence minusXSDateTime(ResultSequence arg) throws DynamicError {
XSDateTime val = (XSDateTime) NumericType.get_single_type(arg, XSDateTime.class);
Calendar thisCal = normalizeCalendar(calendar(), tz());
Calendar thatCal = normalizeCalendar(val.calendar(), val.tz());
long duration = thisCal.getTimeInMillis() - thatCal.getTimeInMillis();
Duration dtduration = _datatypeFactory.newDuration(duration);
return ResultSequenceFactory.create_new(XSDayTimeDuration.parseDTDuration(dtduration.toString()));
}
use of javax.xml.datatype.Duration in project webtools.sourceediting by eclipse.
the class XSDate method minusXSDate.
private ResultSequence minusXSDate(ResultSequence arg) throws DynamicError {
XSDate val = (XSDate) NumericType.get_single_type(arg, XSDate.class);
Duration dtduration = null;
Calendar thisCal = normalizeCalendar(calendar(), tz());
Calendar thatCal = normalizeCalendar(val.calendar(), val.tz());
long duration = thisCal.getTimeInMillis() - thatCal.getTimeInMillis();
dtduration = _datatypeFactory.newDuration(duration);
return ResultSequenceFactory.create_new(XSDayTimeDuration.parseDTDuration(dtduration.toString()));
}
use of javax.xml.datatype.Duration in project webtools.sourceediting by eclipse.
the class XSDate method minusXSDayTimeDuration.
private ResultSequence minusXSDayTimeDuration(AnyType at) {
XSDuration val = (XSDuration) at;
try {
XSDate res = (XSDate) clone();
XMLGregorianCalendar xmlCal = _datatypeFactory.newXMLGregorianCalendar((GregorianCalendar) calendar());
Duration dtduration = _datatypeFactory.newDuration(val.getStringValue());
xmlCal.add(dtduration.negate());
res = new XSDate(xmlCal.toGregorianCalendar(), res.tz());
return ResultSequenceFactory.create_new(res);
} catch (CloneNotSupportedException ex) {
}
return null;
}
use of javax.xml.datatype.Duration in project webtools.sourceediting by eclipse.
the class XSTime method minusXSDayTimeDuration.
private ResultSequence minusXSDayTimeDuration(Item at) {
XSDuration val = (XSDuration) at;
XSTime res = null;
try {
res = (XSTime) clone();
} catch (CloneNotSupportedException err) {
return null;
}
XMLGregorianCalendar xmlCal = _datatypeFactory.newXMLGregorianCalendar((GregorianCalendar) calendar());
Duration dtduration = _datatypeFactory.newDuration(val.getStringValue());
xmlCal.add(dtduration.negate());
res = new XSTime(xmlCal.toGregorianCalendar(), res.tz());
return ResultSequenceFactory.create_new(res);
}
Aggregations