本文整理了Java中net.sf.saxon.value.YearMonthDurationValue.getLengthInMonths()
方法的一些代码示例,展示了YearMonthDurationValue.getLengthInMonths()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YearMonthDurationValue.getLengthInMonths()
方法的具体详情如下:
包路径:net.sf.saxon.value.YearMonthDurationValue
类名称:YearMonthDurationValue
方法名:getLengthInMonths
[英]Get the number of months in the duration
[中]获取持续时间中的月数
代码示例来源:origin: net.sf.saxon/Saxon-HE
/**
* Compare the value to another duration value
*
* @param other The other dateTime value
* @return negative value if this one is the earler, 0 if they are chronologically equal,
* positive value if this one is the later. For this purpose, dateTime values with an unknown
* timezone are considered to be UTC values (the Comparable interface requires
* a total ordering).
* @throws ClassCastException if the other value is not a DateTimeValue (the parameter
* is declared as Object to satisfy the Comparable interface)
*/
public int compareTo(YearMonthDurationValue other) {
return Integer.compare(getLengthInMonths(), other.getLengthInMonths());
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon
/**
* Compare the value to another duration value
*
* @param other The other dateTime value
* @return negative value if this one is the earler, 0 if they are chronologically equal,
* positive value if this one is the later. For this purpose, dateTime values with an unknown
* timezone are considered to be UTC values (the Comparable interface requires
* a total ordering).
* @throws ClassCastException if the other value is not a DateTimeValue (the parameter
* is declared as Object to satisfy the Comparable interface)
*/
public int compareTo(YearMonthDurationValue other) {
return Integer.compare(getLengthInMonths(), other.getLengthInMonths());
}
代码示例来源:origin: net.sf.saxon/Saxon-HE
/**
* Negate a duration (same as subtracting from zero, but it preserves the type of the original duration)
*/
public DurationValue negate() {
return fromMonths(-getLengthInMonths());
}
代码示例来源:origin: net.sourceforge.saxon/saxon
/**
* Negate a duration (same as subtracting from zero, but it preserves the type of the original duration)
*/
public DurationValue negate() {
return fromMonths(-getLengthInMonths());
}
代码示例来源:origin: net.sourceforge.saxon/saxon
/**
* Create a copy of this atomic value, with a different type label
*
* @param typeLabel the type label of the new copy. The caller is responsible for checking that
* the value actually conforms to this type.
*/
public AtomicValue copyAsSubType(AtomicType typeLabel) {
YearMonthDurationValue v = YearMonthDurationValue.fromMonths(getLengthInMonths());
v.typeLabel = typeLabel;
return v;
}
代码示例来源:origin: net.sf.saxon/Saxon-HE
/**
* Create a copy of this atomic value, with a different type label
*
* @param typeLabel the type label of the new copy. The caller is responsible for checking that
* the value actually conforms to this type.
*/
/*@NotNull*/
public AtomicValue copyAsSubType(AtomicType typeLabel) {
YearMonthDurationValue v = YearMonthDurationValue.fromMonths(getLengthInMonths());
v.typeLabel = typeLabel;
return v;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon
/**
* Create a copy of this atomic value, with a different type label
*
* @param typeLabel the type label of the new copy. The caller is responsible for checking that
* the value actually conforms to this type.
*/
/*@NotNull*/
public AtomicValue copyAsSubType(AtomicType typeLabel) {
YearMonthDurationValue v = YearMonthDurationValue.fromMonths(getLengthInMonths());
v.typeLabel = typeLabel;
return v;
}
代码示例来源:origin: org.opengis.cite.saxon/saxon9
/**
* Create a copy of this atomic value, with a different type label
*
* @param typeLabel the type label of the new copy. The caller is responsible for checking that
* the value actually conforms to this type.
*/
public AtomicValue copyAsSubType(AtomicType typeLabel) {
YearMonthDurationValue v = YearMonthDurationValue.fromMonths(getLengthInMonths());
v.typeLabel = typeLabel;
return v;
}
代码示例来源:origin: org.opengis.cite.saxon/saxon9
/**
* Negate a duration (same as subtracting from zero, but it preserves the type of the original duration)
*/
public DurationValue negate() {
return fromMonths(-getLengthInMonths());
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon
/**
* Negate a duration (same as subtracting from zero, but it preserves the type of the original duration)
*/
public DurationValue negate() {
return fromMonths(-getLengthInMonths());
}
代码示例来源:origin: net.sf.saxon/Saxon-HE
/**
* Add two year-month-durations
*/
public DurationValue add(DurationValue other) throws XPathException {
if (other instanceof YearMonthDurationValue) {
return fromMonths(getLengthInMonths() +
((YearMonthDurationValue) other).getLengthInMonths());
} else {
XPathException err = new XPathException("Cannot add two durations of different type");
err.setErrorCode("XPTY0004");
throw err;
}
}
代码示例来源:origin: net.sf.saxon/Saxon-HE
/**
* Subtract two year-month-durations
*/
public DurationValue subtract(DurationValue other) throws XPathException {
if (other instanceof YearMonthDurationValue) {
return fromMonths(getLengthInMonths() -
((YearMonthDurationValue) other).getLengthInMonths());
} else {
XPathException err = new XPathException("Cannot subtract two durations of different type");
err.setErrorCode("XPTY0004");
throw err;
}
}
代码示例来源:origin: net.sourceforge.saxon/saxon
/**
* Subtract two year-month-durations
*/
public DurationValue subtract(DurationValue other) throws XPathException {
if (other instanceof YearMonthDurationValue) {
return fromMonths(getLengthInMonths() -
((YearMonthDurationValue)other).getLengthInMonths());
} else {
XPathException err = new XPathException("Cannot subtract two durations of different type");
err.setErrorCode("XPTY0004");
throw err;
}
}
代码示例来源:origin: org.opengis.cite.saxon/saxon9
/**
* Subtract two year-month-durations
*/
public DurationValue subtract(DurationValue other) throws XPathException {
if (other instanceof YearMonthDurationValue) {
return fromMonths(getLengthInMonths() -
((YearMonthDurationValue)other).getLengthInMonths());
} else {
XPathException err = new XPathException("Cannot subtract two durations of different type");
err.setErrorCode("XPTY0004");
throw err;
}
}
代码示例来源:origin: net.sourceforge.saxon/saxon
/**
* Add two year-month-durations
*/
public DurationValue add(DurationValue other) throws XPathException {
if (other instanceof YearMonthDurationValue) {
return fromMonths(getLengthInMonths() +
((YearMonthDurationValue)other).getLengthInMonths());
} else {
XPathException err = new XPathException("Cannot add two durations of different type");
err.setErrorCode("XPTY0004");
throw err;
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon
/**
* Add two year-month-durations
*/
public DurationValue add(DurationValue other) throws XPathException {
if (other instanceof YearMonthDurationValue) {
return fromMonths(getLengthInMonths() +
((YearMonthDurationValue) other).getLengthInMonths());
} else {
XPathException err = new XPathException("Cannot add two durations of different type");
err.setErrorCode("XPTY0004");
throw err;
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon
/**
* Subtract two year-month-durations
*/
public DurationValue subtract(DurationValue other) throws XPathException {
if (other instanceof YearMonthDurationValue) {
return fromMonths(getLengthInMonths() -
((YearMonthDurationValue) other).getLengthInMonths());
} else {
XPathException err = new XPathException("Cannot subtract two durations of different type");
err.setErrorCode("XPTY0004");
throw err;
}
}
代码示例来源:origin: org.opengis.cite.saxon/saxon9
/**
* Add two year-month-durations
*/
public DurationValue add(DurationValue other) throws XPathException {
if (other instanceof YearMonthDurationValue) {
return fromMonths(getLengthInMonths() +
((YearMonthDurationValue)other).getLengthInMonths());
} else {
XPathException err = new XPathException("Cannot add two durations of different type");
err.setErrorCode("XPTY0004");
throw err;
}
}
代码示例来源:origin: net.sf.saxon/Saxon-HE
/**
* Multiply duration by a number.
*/
public YearMonthDurationValue multiply(double n) throws XPathException {
if (Double.isNaN(n)) {
XPathException err = new XPathException("Cannot multiply a duration by NaN");
err.setErrorCode("FOCA0005");
throw err;
}
double m = (double) getLengthInMonths();
double product = n * m;
if (Double.isInfinite(product) || product > Integer.MAX_VALUE || product < Integer.MIN_VALUE) {
XPathException err = new XPathException("Overflow when multiplying a duration by a number");
err.setErrorCode("FODT0002");
throw err;
}
return fromMonths((int) Math.round(product));
}
代码示例来源:origin: net.sf.saxon/Saxon-HE
/**
* Divide duration by a number.
*/
public DurationValue divide(double n) throws XPathException {
if (Double.isNaN(n)) {
XPathException err = new XPathException("Cannot divide a duration by NaN");
err.setErrorCode("FOCA0005");
throw err;
}
double m = (double) getLengthInMonths();
double product = m / n;
if (Double.isInfinite(product) || product > Integer.MAX_VALUE || product < Integer.MIN_VALUE) {
XPathException err = new XPathException("Overflow when dividing a duration by a number");
err.setErrorCode("FODT0002");
throw err;
}
return fromMonths((int) Math.round(product));
}
内容来源于网络,如有侵权,请联系作者删除!