Package org.projog.clp
Class NumberSet
java.lang.Object
org.projog.clp.NumberSet
A set of
long primitives.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) intReturns the count of values set in thisNumberSet.(package private) voidclear(long not) Unsets (i.e.(package private) voidclear(long fromValue, long toValue) Unsets all values between the givenfromValue(inclusive) andtoValue(inclusive).(package private) NumberSetcopy()Returns a new copy of thisNumberSet.boolean(package private) booleanget(long value) Returnstrueif the given value is set, elsefalse.inthashCode()(package private) longnextSetValue(long value) Returns the value that occurs on or after the specifiedvalue.(package private) longpreviousSetValue(long value) Returns the value that occurs on or before the specifiedvalue.toString()Returns all values contained in this set, in order, separated by commas and surrounded by braces.
-
Field Details
-
start
private final long startThe value that the first bit of the bitset represents. -
bitset
-
-
Constructor Details
-
NumberSet
NumberSet(long start, long end) Constructs a newNumberSetcontaining all values within the specified range (inclusive).- Parameters:
start- the minimum value to be stored (inclusive)end- the maximum value to be stored (inclusive)
-
NumberSet
-
-
Method Details
-
copy
NumberSet copy()Returns a new copy of thisNumberSet. -
get
boolean get(long value) Returnstrueif the given value is set, elsefalse. -
clear
void clear(long fromValue, long toValue) Unsets all values between the givenfromValue(inclusive) andtoValue(inclusive).NOTE: Unlike java.util.BitSet.clear(int, int) both values are *inclusive*.
-
clear
void clear(long not) Unsets (i.e. remove from thisNumberSet) the given value. -
nextSetValue
long nextSetValue(long value) Returns the value that occurs on or after the specifiedvalue.- Parameters:
value- fromIndex the index to start checking from (inclusive)- Returns:
- the value that occurs on or after the specified value, or
start - 1is no such value
-
previousSetValue
long previousSetValue(long value) Returns the value that occurs on or before the specifiedvalue.- Parameters:
value- fromIndex the index to start checking from (inclusive)- Returns:
- the value that occurs on or after the specified value, or
start - 1is no such value
-
cardinality
int cardinality()Returns the count of values set in thisNumberSet. -
toString
Returns all values contained in this set, in order, separated by commas and surrounded by braces. -
equals
-
hashCode
public int hashCode()
-