org.jfree.data.Range.shiftWithNoZeroCrossing()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(1.7k)|赞(0)|评价(0)|浏览(195)

本文整理了Java中org.jfree.data.Range.shiftWithNoZeroCrossing方法的一些代码示例,展示了Range.shiftWithNoZeroCrossing的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Range.shiftWithNoZeroCrossing方法的具体详情如下:
包路径:org.jfree.data.Range
类名称:Range
方法名:shiftWithNoZeroCrossing

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));
  }
}

相关文章