|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--grendel.storage.NewsSet
This class represents a set of integers. It uses a highly compressed encoding, taking advantage of the assumption that many of the integers are consecutive. This is intended for representing lines from the .newsrc file, which have lists of message-numbers lists like
1-29627,29635,29658,32861-32863
so the data has these properties:
Constructor Summary | |
NewsSet()
|
|
NewsSet(byte[] chars,
int start,
int end)
|
|
NewsSet(ByteBuf chars)
|
|
NewsSet(java.lang.String chars)
|
Method Summary | |
long |
countMissingInRange(long range_start,
long range_end)
Returns the number of elements in the range [start, end) which are not members of the set. |
boolean |
delete(long number)
Cause the number to not be a member of the set. |
boolean |
delete(long start,
long end)
Cause the numbers in the range [start, end) to not be members of the set. |
long |
firstNonMember()
Returns the lowest non-member of the set greater than 0. |
long |
firstNonMember(long min,
long max)
Returns the first number which is not a member of the set, which falls in the range [min, max). |
boolean |
insert(long number)
Cause the number to be a member of the set. |
boolean |
insert(long start,
long end)
Cause the numbers in the range [start, end) to be members of the set. |
protected boolean |
isEmpty()
True if there are no elements in the set. |
long |
lastNonMember(long min,
long max)
Returns the last number which is not a member of the set, which falls in the range [min, max). |
static void |
main(java.lang.String[] args)
|
void |
markDirty()
Called when a change is made to the set. |
long |
max()
Returns the largest element of the set. |
boolean |
member(long number)
Returns whether the number is a member of the set. |
long |
min()
Returns the smallest element of the set. |
long |
nextMember(long after)
Returns the first number which is in the set, and which is greater than the given value. |
long |
previousMember(long after)
Returns the last number which is in the set, and which is less than the given value. |
protected static void |
self_test_adder()
|
protected static void |
self_test_adder(NewsSet set,
boolean add_p,
long value,
java.lang.String target)
|
protected static void |
self_test_decoder()
|
protected static void |
self_test_decoder(java.lang.String s,
java.lang.String target)
Self tests |
protected static void |
self_test_first_nonmember(boolean cache)
|
protected static void |
self_test_first_nonmember(NewsSet set,
boolean cache,
long start,
long end,
long target)
|
protected static void |
self_test_last_nonmember(boolean cache)
|
protected static void |
self_test_last_nonmember(NewsSet set,
boolean cache,
long start,
long end,
long target)
|
protected static void |
self_test_member(boolean cache)
|
protected static void |
self_test_member(NewsSet set,
boolean cache,
long elt,
boolean target)
|
protected static void |
self_test_next_member(boolean cache)
|
protected static void |
self_test_next_member(NewsSet set,
boolean cache,
long elt,
long target)
|
protected static void |
self_test_prev_member(boolean cache)
|
protected static void |
self_test_prev_member(NewsSet set,
boolean cache,
long elt,
long target)
|
protected static void |
self_test_ranges()
|
protected static void |
self_test_ranges(NewsSet set,
long start,
long end,
java.lang.String target)
|
protected static void |
self_test()
|
java.lang.String |
toString()
|
void |
write(ByteBuf out)
Converts a printed representation of the numbers in the set. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Constructor Detail |
public NewsSet()
public NewsSet(java.lang.String chars)
public NewsSet(ByteBuf chars)
public NewsSet(byte[] chars, int start, int end)
Method Detail |
public long firstNonMember()
public long min()
public long max()
public boolean member(long number)
public boolean insert(long number)
public boolean delete(long number)
public boolean insert(long start, long end)
public boolean delete(long start, long end)
public long countMissingInRange(long range_start, long range_end)
public long firstNonMember(long min, long max)
public long lastNonMember(long min, long max)
public long nextMember(long after)
public long previousMember(long after)
protected boolean isEmpty()
public void markDirty()
public void write(ByteBuf out)
public java.lang.String toString()
protected static void self_test_decoder(java.lang.String s, java.lang.String target)
protected static void self_test_decoder()
protected static void self_test_adder(NewsSet set, boolean add_p, long value, java.lang.String target)
protected static void self_test_adder()
protected static void self_test_ranges(NewsSet set, long start, long end, java.lang.String target)
protected static void self_test_ranges()
protected static void self_test_member(NewsSet set, boolean cache, long elt, boolean target)
protected static void self_test_first_nonmember(NewsSet set, boolean cache, long start, long end, long target)
protected static void self_test_last_nonmember(NewsSet set, boolean cache, long start, long end, long target)
protected static void self_test_next_member(NewsSet set, boolean cache, long elt, long target)
protected static void self_test_prev_member(NewsSet set, boolean cache, long elt, long target)
protected static void self_test_member(boolean cache)
protected static void self_test_first_nonmember(boolean cache)
protected static void self_test_last_nonmember(boolean cache)
protected static void self_test_next_member(boolean cache)
protected static void self_test_prev_member(boolean cache)
protected static void self_test()
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |