MCPcopy Index your code
hub / github.com/apache/groovy / by

Method by

src/main/java/groovy/lang/NumberRange.java:243–248  ·  view source on GitHub ↗

For a NumberRange with step size 1, creates a new NumberRange with the same from and to as this NumberRange but with a step size of stepSize . @param stepSize the desired step size @return a new NumberRange

(T stepSize)

Source from the content-addressed store, hash-verified

241 * @return a new NumberRange
242 */
243 public <T extends Number & Comparable> NumberRange by(T stepSize) {
244 if (!Integer.valueOf(1).equals(this.stepSize)) {
245 throw new IllegalStateException("by only allowed on ranges with original stepSize = 1 but found " + this.stepSize);
246 }
247 return new NumberRange(comparableNumber(from), comparableNumber(to), stepSize, inclusiveLeft, inclusiveRight);
248 }
249
250 /**
251 * Casts the supplied comparable to a comparable number.

Callers

nothing calls this directly

Calls 3

comparableNumberMethod · 0.95
equalsMethod · 0.65
valueOfMethod · 0.45

Tested by

no test coverage detected