de.lmu.ifi.dbs.elki.database.ids.generic
Class MaskedDBIDs

java.lang.Object
  extended by java.util.AbstractCollection<DBID>
      extended by de.lmu.ifi.dbs.elki.database.ids.generic.MaskedDBIDs
All Implemented Interfaces:
DBIDs, Iterable<DBID>, Collection<DBID>

public class MaskedDBIDs
extends AbstractCollection<DBID>
implements DBIDs, Collection<DBID>

View on an ArrayDBIDs masked using a BitMask for efficient mask changing.


Nested Class Summary
protected  class MaskedDBIDs.InvItr
          Iterator over unset elements.
protected  class MaskedDBIDs.Itr
          Iterator over set bits
 
Field Summary
protected  BitSet bits
          The bitmask used for masking
protected  ArrayDBIDs data
          Data storage
protected  boolean inverse
          Flag whether to iterator over set or unset values.
 
Constructor Summary
MaskedDBIDs(ArrayDBIDs data, BitSet bits, boolean inverse)
          Constructor.
 
Method Summary
 boolean add(DBID e)
           
 Collection<DBID> asCollection()
          Retrieve collection access to the IDs
 void clear()
           
 Iterator<DBID> iterator()
          Retrieve Iterator access to the IDs.
 boolean remove(Object o)
           
 int size()
          Retrieve the collection / data size.
 
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, removeAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface de.lmu.ifi.dbs.elki.database.ids.DBIDs
contains, isEmpty
 
Methods inherited from interface java.util.Collection
addAll, contains, containsAll, equals, hashCode, isEmpty, removeAll, retainAll, toArray, toArray
 

Field Detail

data

protected ArrayDBIDs data
Data storage


bits

protected BitSet bits
The bitmask used for masking


inverse

protected boolean inverse
Flag whether to iterator over set or unset values.

Constructor Detail

MaskedDBIDs

public MaskedDBIDs(ArrayDBIDs data,
                   BitSet bits,
                   boolean inverse)
Constructor.

Parameters:
data - Data
bits - Bitset to use as mask
inverse - Flag to inverse the masking rule
Method Detail

iterator

public Iterator<DBID> iterator()
Description copied from interface: DBIDs
Retrieve Iterator access to the IDs.

Specified by:
iterator in interface DBIDs
Specified by:
iterator in interface Iterable<DBID>
Specified by:
iterator in interface Collection<DBID>
Specified by:
iterator in class AbstractCollection<DBID>
Returns:
an iterator for the IDs

asCollection

public Collection<DBID> asCollection()
Description copied from interface: DBIDs
Retrieve collection access to the IDs

Specified by:
asCollection in interface DBIDs
Returns:
a collection of IDs

size

public int size()
Description copied from interface: DBIDs
Retrieve the collection / data size.

Specified by:
size in interface DBIDs
Specified by:
size in interface Collection<DBID>
Specified by:
size in class AbstractCollection<DBID>
Returns:
collection size

add

public boolean add(DBID e)
Specified by:
add in interface Collection<DBID>
Overrides:
add in class AbstractCollection<DBID>

remove

public boolean remove(Object o)
Specified by:
remove in interface Collection<DBID>
Overrides:
remove in class AbstractCollection<DBID>

clear

public void clear()
Specified by:
clear in interface Collection<DBID>
Overrides:
clear in class AbstractCollection<DBID>

Release 0.4.0 (2011-09-20_1324)