Qizx/open API

net.axyana.qizxopen.util
Class BitIdSet

java.lang.Object
  extended bynet.axyana.qizxopen.util.IdSet
      extended bynet.axyana.qizxopen.util.BitIdSet

public class BitIdSet
extends IdSet

A set of (positive) integer identifiers. A bit optimized for sparse sets. TODO list impl for really sparse sets


Constructor Summary
BitIdSet()
           
BitIdSet(int id)
           
 
Method Summary
 BitIdSet add(int id)
           
 BitIdSet add(int first, int last)
           
 void clear()
          Clear all elements.
 IdSet copy()
           
 void dump(java.io.PrintStream output)
           
 int getNext(int id)
          Iteration mechanism: returns the first id in the set that is >= to argument.
 void load(net.axyana.qizxopen.util.io.ByteInput input)
           
 void remove(int id)
           
 IdSet removeAll(IdSet other)
          Remove all members of another from this one.
 void save(net.axyana.qizxopen.util.io.ByteOutput output)
           
 java.lang.StringBuffer show(int maxSize)
           
 int size()
           
 boolean test(int id)
          Identifier containment test.
 IdSet unionWith(IdSet other)
          Union with any set.
 
Methods inherited from class net.axyana.qizxopen.util.IdSet
intersects, isEmpty
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BitIdSet

public BitIdSet()

BitIdSet

public BitIdSet(int id)
Method Detail

test

public boolean test(int id)
Description copied from class: IdSet
Identifier containment test.

Specified by:
test in class IdSet

copy

public IdSet copy()
Specified by:
copy in class IdSet

add

public BitIdSet add(int id)

add

public BitIdSet add(int first,
                    int last)

remove

public void remove(int id)

clear

public void clear()
Clear all elements. Does not reallocate.


unionWith

public IdSet unionWith(IdSet other)
Union with any set. Optimized for BitIdSets.


removeAll

public IdSet removeAll(IdSet other)
Remove all members of another from this one.


getNext

public int getNext(int id)
Iteration mechanism: returns the first id in the set that is >= to argument.

Specified by:
getNext in class IdSet
Returns:
-1 if no next id.

size

public int size()

save

public void save(net.axyana.qizxopen.util.io.ByteOutput output)
          throws java.io.IOException
Throws:
java.io.IOException

load

public void load(net.axyana.qizxopen.util.io.ByteInput input)
          throws java.io.IOException
Throws:
java.io.IOException

dump

public void dump(java.io.PrintStream output)

show

public java.lang.StringBuffer show(int maxSize)

© 2005 Axyana Software