org.specrunner.util.math
Class Range

java.lang.Object
  extended by org.specrunner.util.math.Range

public final class Range
extends Object

Range of integers.

Author:
Thiago Santos

Field Summary
static String RANGE
          Undefined range.
 
Method Summary
 boolean between(int index)
          Check if value belongs to a range.
static Range getRange(String range, int min, int max)
          Get a range.
static List<Range> getRanges(String ranges, String separator, int min, int max)
          Range list creator.
 String toString()
           
 boolean valid()
          A valid range has start lower than end.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RANGE

public static final String RANGE
Undefined range.

See Also:
Constant Field Values
Method Detail

between

public boolean between(int index)
Check if value belongs to a range.

Parameters:
index - Value.
Returns:
true, if belongs to range, false, otherwise.

valid

public boolean valid()
A valid range has start lower than end.

Returns:
true, if valid, false, otherwise.

getRange

public static Range getRange(String range,
                             int min,
                             int max)
Get a range.

Parameters:
range - String representation.
min - Min value.
max - Max value.
Returns:
A range, if valid, null, otherwise.

getRanges

public static List<Range> getRanges(String ranges,
                                    String separator,
                                    int min,
                                    int max)
Range list creator.

Parameters:
ranges - Representation.
separator - Token separator.
min - Min value.
max - Max value.
Returns:
A list of ranges.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2015. All rights reserved.