java.lang.Object
com.pervasive.datarush.io.PortRange
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassAn iterator that can be used to randomly iterate through all possible values of the disjoint range. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancontains(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.Returns a random element contained by the port range or null if the range is empty.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, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
PortRange
public PortRange()Create an empty port range. -
PortRange
Create a port range including all elements in a set.- Parameters:
rangeSet- the elements of the ranges
-
-
Method Details
-
createPortRange
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
Returns a random element contained by the port range or null if the range is empty.- Returns:
- a random element
-
iterator
-