javatools.datatypes
Class BitVector
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractSet<java.lang.Integer>
javatools.datatypes.BitVector
- All Implemented Interfaces:
- java.lang.Iterable<java.lang.Integer>, java.util.Collection<java.lang.Integer>, java.util.Set<java.lang.Integer>
public class BitVector
- extends java.util.AbstractSet<java.lang.Integer>
This class is part of the Java Tools (see http://mpii.de/yago-naga/javatools).
It is licensed under the Creative Commons Attribution License
(see http://creativecommons.org/licenses/by/3.0) by
the YAGO-NAGA team (see http://mpii.de/yago-naga).
This class implements an efficient boolean (bit) list . It wraps BitSet into a set of Integers
Methods inherited from class java.util.AbstractSet |
equals, hashCode, removeAll |
Methods inherited from class java.util.AbstractCollection |
addAll, containsAll, retainAll, toArray, toArray |
Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Set |
addAll, containsAll, retainAll, toArray, toArray |
BitVector
public BitVector(int capacity)
BitVector
public BitVector(BitVector v)
BitVector
public BitVector()
add
public boolean add(java.lang.Integer pos)
- Specified by:
add
in interface java.util.Collection<java.lang.Integer>
- Specified by:
add
in interface java.util.Set<java.lang.Integer>
- Overrides:
add
in class java.util.AbstractCollection<java.lang.Integer>
add
public boolean add(int pos)
remove
public boolean remove(java.lang.Object pos)
- Specified by:
remove
in interface java.util.Collection<java.lang.Integer>
- Specified by:
remove
in interface java.util.Set<java.lang.Integer>
- Overrides:
remove
in class java.util.AbstractCollection<java.lang.Integer>
remove
public boolean remove(int pos)
contains
public boolean contains(java.lang.Object arg0)
- Specified by:
contains
in interface java.util.Collection<java.lang.Integer>
- Specified by:
contains
in interface java.util.Set<java.lang.Integer>
- Overrides:
contains
in class java.util.AbstractCollection<java.lang.Integer>
contains
public boolean contains(int index)
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interface java.util.Collection<java.lang.Integer>
- Specified by:
isEmpty
in interface java.util.Set<java.lang.Integer>
- Overrides:
isEmpty
in class java.util.AbstractCollection<java.lang.Integer>
size
public int size()
- Specified by:
size
in interface java.util.Collection<java.lang.Integer>
- Specified by:
size
in interface java.util.Set<java.lang.Integer>
- Specified by:
size
in class java.util.AbstractCollection<java.lang.Integer>
clear
public void clear()
- Specified by:
clear
in interface java.util.Collection<java.lang.Integer>
- Specified by:
clear
in interface java.util.Set<java.lang.Integer>
- Overrides:
clear
in class java.util.AbstractCollection<java.lang.Integer>
toString
public java.lang.String toString()
- Overrides:
toString
in class java.util.AbstractCollection<java.lang.Integer>
compress
public void compress()
iterator
public PeekIterator<java.lang.Integer> iterator()
- Specified by:
iterator
in interface java.lang.Iterable<java.lang.Integer>
- Specified by:
iterator
in interface java.util.Collection<java.lang.Integer>
- Specified by:
iterator
in interface java.util.Set<java.lang.Integer>
- Specified by:
iterator
in class java.util.AbstractCollection<java.lang.Integer>
main
public static void main(java.lang.String[] args)
- Test