本文整理了Java中net.sf.saxon.value.YearMonthDurationValue.fromMonths()
方法的一些代码示例,展示了YearMonthDurationValue.fromMonths()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YearMonthDurationValue.fromMonths()
方法的具体详情如下:
包路径:net.sf.saxon.value.YearMonthDurationValue
类名称:YearMonthDurationValue
方法名:fromMonths
[英]Construct a duration value as a number of months.
[中]将持续时间值构造为月数。
代码示例来源: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.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: 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.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: 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
/**
* 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: net.sf.saxon/Saxon-HE
public YearMonthDurationValue convert(AtomicValue input) {
return YearMonthDurationValue.fromMonths(((DurationValue) input).getTotalMonths());
}
}
代码示例来源: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: org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon
public YearMonthDurationValue convert(AtomicValue input) {
return YearMonthDurationValue.fromMonths(((DurationValue) input).getTotalMonths());
}
}
代码示例来源: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
/**
* Static factory: create a year-month duration value from a supplied string, in
* ISO 8601 format [+|-]PnYnM
*
* @param s a string in the lexical space of xs:yearMonthDuration.
* @return either a YearMonthDurationValue, or a ValidationFailure if the string was
* not in the lexical space of xs:yearMonthDuration.
*/
public static ConversionResult makeYearMonthDurationValue(CharSequence s) {
ConversionResult d = DurationValue.makeDuration(s, true, false);
if (d instanceof ValidationFailure) {
return d;
}
DurationValue dv = (DurationValue) d;
return YearMonthDurationValue.fromMonths((dv.getYears() * 12 + dv.getMonths()) * dv.signum());
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon
/**
* Static factory: create a year-month duration value from a supplied string, in
* ISO 8601 format [+|-]PnYnM
*
* @param s a string in the lexical space of xs:yearMonthDuration.
* @return either a YearMonthDurationValue, or a ValidationFailure if the string was
* not in the lexical space of xs:yearMonthDuration.
*/
public static ConversionResult makeYearMonthDurationValue(CharSequence s) {
ConversionResult d = DurationValue.makeDuration(s, true, false);
if (d instanceof ValidationFailure) {
return d;
}
DurationValue dv = (DurationValue) d;
return YearMonthDurationValue.fromMonths((dv.getYears() * 12 + dv.getMonths()) * dv.signum());
}
内容来源于网络,如有侵权,请联系作者删除!