本文整理了Java中org.jfree.data.Range.shiftWithNoZeroCrossing
方法的一些代码示例,展示了Range.shiftWithNoZeroCrossing
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Range.shiftWithNoZeroCrossing
方法的具体详情如下:
包路径:org.jfree.data.Range
类名称:Range
方法名:shiftWithNoZeroCrossing
[英]Returns the given value adjusted by delta but with a check to prevent the result from crossing 0.0.
[中]返回按增量调整的给定值,但带有一个检查,以防止结果超过0.0。
代码示例来源:origin: org.codehaus.jtstand/jtstand-chart
/**
* Shifts the range by the specified amount.
*
* @param base the base range (<code>null</code> not permitted).
* @param delta the shift amount.
* @param allowZeroCrossing a flag that determines whether or not the
* bounds of the range are allowed to cross
* zero after adjustment.
*
* @return A new range.
*/
public static Range shift(Range base, double delta,
boolean allowZeroCrossing) {
if (base == null) {
throw new IllegalArgumentException("Null 'base' argument.");
}
if (allowZeroCrossing) {
return new Range(base.getLowerBound() + delta,
base.getUpperBound() + delta);
}
else {
return new Range(shiftWithNoZeroCrossing(base.getLowerBound(),
delta), shiftWithNoZeroCrossing(base.getUpperBound(),
delta));
}
}
代码示例来源:origin: jfree/jfreechart
/**
* Shifts the range by the specified amount.
*
* @param base the base range ({@code null} not permitted).
* @param delta the shift amount.
* @param allowZeroCrossing a flag that determines whether or not the
* bounds of the range are allowed to cross
* zero after adjustment.
*
* @return A new range.
*/
public static Range shift(Range base, double delta,
boolean allowZeroCrossing) {
Args.nullNotPermitted(base, "base");
if (allowZeroCrossing) {
return new Range(base.getLowerBound() + delta,
base.getUpperBound() + delta);
}
else {
return new Range(shiftWithNoZeroCrossing(base.getLowerBound(),
delta), shiftWithNoZeroCrossing(base.getUpperBound(),
delta));
}
}
内容来源于网络,如有侵权,请联系作者删除!