- java.lang.Object
-
- com.pervasive.datarush.io.PortRange
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classPortRange.RandomIteratorAn iterator that can be used to randomly iterate through all possible values of the disjoint range.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontains(int i)Returns true if this range contains the specified element.static PortRangecreatePortRange(String ranges)This method can be used to create sets containing all the possible values in a multiple partial ranges.IntegergetRandomElement()Returns a random element contained by the port range or null if the range is empty.Iterator<Integer>iterator()intsize()Returns the number of elements in the range.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
createPortRange
public static PortRange createPortRange(String ranges)
This method can be used to create sets containing all the possible values in a multiple partial ranges. Creates a range set from a string in the form:::= | - | , This is useful when handling port ranges. - Parameters:
ranges- a string with the required format- Returns:
- a disjoint range containing all the possible values
-
size
public int size()
Returns the number of elements in the range.- Returns:
- number of elements in this range
-
contains
public boolean contains(int i)
Returns true if this range contains the specified element.- Parameters:
i- element to be checked for containment in this range- Returns:
- true if this range contains the element
-
getRandomElement
public Integer getRandomElement()
Returns a random element contained by the port range or null if the range is empty.- Returns:
- a random element
-
-