de.lmu.ifi.dbs.elki.utilities
Class Util.MaskedArrayList<T>

java.lang.Object
  extended by java.util.AbstractCollection<T>
      extended by de.lmu.ifi.dbs.elki.utilities.Util.MaskedArrayList<T>
Type Parameters:
T - Object type
All Implemented Interfaces:
Iterable<T>, Collection<T>
Enclosing class:
Util

public static class Util.MaskedArrayList<T>
extends AbstractCollection<T>
implements Collection<T>

This class is a virtual collection based on masking an array list using a bit mask.


Nested Class Summary
protected  class Util.MaskedArrayList.InvItr
          Iterator over unset elements.
protected  class Util.MaskedArrayList.Itr
          Iterator over set bits
 
Field Summary
protected  BitSet bits
          The bitmask used for masking
protected  ArrayList<T> data
          Data storage
protected  boolean inverse
          Flag whether to iterator over set or unset values.
 
Constructor Summary
Util.MaskedArrayList(ArrayList<T> data, BitSet bits, boolean inverse)
          Constructor.
 
Method Summary
 boolean add(T e)
           
 Iterator<T> iterator()
           
 int size()
           
 
Methods inherited from class java.util.AbstractCollection
addAll, clear, contains, containsAll, isEmpty, remove, 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 java.util.Collection
addAll, clear, contains, containsAll, equals, hashCode, isEmpty, remove, removeAll, retainAll, toArray, toArray
 

Field Detail

data

protected ArrayList<T> 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

Util.MaskedArrayList

public Util.MaskedArrayList(ArrayList<T> data,
                            BitSet bits,
                            boolean inverse)
Constructor.

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

add

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

iterator

public Iterator<T> iterator()
Specified by:
iterator in interface Iterable<T>
Specified by:
iterator in interface Collection<T>
Specified by:
iterator in class AbstractCollection<T>

size

public int size()
Specified by:
size in interface Collection<T>
Specified by:
size in class AbstractCollection<T>

Release 0.4.0 (2011-09-20_1324)