Package org.projog.clp
Class NumberSet
- java.lang.Object
-
- org.projog.clp.NumberSet
-
final class NumberSet extends java.lang.ObjectA set oflongprimitives.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) intcardinality()Returns 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.booleanequals(java.lang.Object o)(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.java.lang.StringtoString()Returns all values contained in this set, in order, separated by commas and surrounded by braces.
-
-
-
Constructor Detail
-
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
private NumberSet(long start, java.util.BitSet bitset)
-
-
Method Detail
-
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
public java.lang.String toString()
Returns all values contained in this set, in order, separated by commas and surrounded by braces.- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-