Class AbstractBitVector.SubBitVector
- java.lang.Object
-
- java.util.AbstractCollection<java.lang.Boolean>
-
- it.unimi.dsi.fastutil.booleans.AbstractBooleanCollection
-
- it.unimi.dsi.fastutil.booleans.AbstractBooleanBigList
-
- it.unimi.dsi.bits.AbstractBitVector
-
- it.unimi.dsi.bits.AbstractBitVector.SubBitVector
-
- All Implemented Interfaces:
BitVector,it.unimi.dsi.fastutil.BigList<java.lang.Boolean>,it.unimi.dsi.fastutil.booleans.BooleanBigList,it.unimi.dsi.fastutil.booleans.BooleanCollection,it.unimi.dsi.fastutil.booleans.BooleanIterable,it.unimi.dsi.fastutil.booleans.BooleanStack,it.unimi.dsi.fastutil.Size64,it.unimi.dsi.fastutil.Stack<java.lang.Boolean>,java.lang.Comparable<it.unimi.dsi.fastutil.BigList<? extends java.lang.Boolean>>,java.lang.Iterable<java.lang.Boolean>,java.util.Collection<java.lang.Boolean>,java.util.RandomAccess
- Enclosing class:
- AbstractBitVector
public static class AbstractBitVector.SubBitVector extends AbstractBitVector implements BitVector
A subvector of a given bit vector, specified by an initial and a final bit.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class it.unimi.dsi.bits.AbstractBitVector
AbstractBitVector.LongBigListView, AbstractBitVector.LongSetView, AbstractBitVector.SubBitVector
-
-
Constructor Summary
Constructors Constructor Description SubBitVector(BitVector l, long from, long to)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int value)Adds a bit with specified value at the end of this bit vector.voidadd(long index, boolean value)voidadd(long index, int value)Adds a bit with specified integer value at the specified index (optional operation).it.unimi.dsi.fastutil.longs.LongSortedSetasLongSet()Returns a view of this bit vector as a sorted set of long integers.BitVectorcopy(long from, long to)Returns a copy of a part of this bit vector.booleangetBoolean(long index)intgetInt(long index)Returns the value of the specified bit as an integer.longgetLong(long from, long to)Returns the specified bit range as a long.longlength()Returns the number of bits in this bit vector.booleanremoveBoolean(long index)booleanset(long index, boolean value)voidset(long index, int value)Sets the value of the specified bit as an integer (optional operation).longsize64()BitVectorsubVector(long from, long to)Returns a subvector view specified by initial and final index.-
Methods inherited from class it.unimi.dsi.bits.AbstractBitVector
add, add, and, append, append, asLongBigList, bits, clear, clear, clear, compareTo, compareTo, copy, count, ensureIndex, ensureRestrictedIndex, equals, equals, fast, fill, fill, fill, fill, firstOne, firstZero, flip, flip, flip, flip, getBoolean, hashCode, isPrefix, isProperPrefix, lastOne, lastZero, length, longestCommonPrefixLength, nextOne, nextZero, or, previousOne, previousZero, removeBoolean, replace, set, set, set, size, size, subVector, toString, xor
-
Methods inherited from class it.unimi.dsi.fastutil.booleans.AbstractBooleanBigList
add, addAll, addAll, addAll, addAll, addElements, addElements, contains, forEach, get, getElements, indexOf, indexOf, iterator, lastIndexOf, lastIndexOf, listIterator, listIterator, peek, peekBoolean, pop, popBoolean, push, push, rem, remove, removeElements, set, setElements, subList, top, topBoolean
-
Methods inherited from class it.unimi.dsi.fastutil.booleans.AbstractBooleanCollection
add, contains, containsAll, containsAll, remove, removeAll, removeAll, retainAll, retainAll, toArray, toBooleanArray, toBooleanArray
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface it.unimi.dsi.bits.BitVector
and, append, append, asLongBigList, bits, clear, copy, count, equals, fast, fill, fill, fill, fill, firstOne, firstZero, flip, flip, flip, hashCode, isPrefix, isProperPrefix, lastOne, lastZero, length, longestCommonPrefixLength, nextOne, nextZero, or, previousOne, previousZero, replace, set, size, subVector, xor
-
Methods inherited from interface it.unimi.dsi.fastutil.booleans.BooleanBigList
add, addAll, addAll, addAll, addAll, addAll, addElements, addElements, get, getElements, getElements, indexOf, indexOf, iterator, lastIndexOf, lastIndexOf, listIterator, listIterator, remove, removeElements, set, setElements, setElements, setElements, spliterator, subList
-
Methods inherited from interface it.unimi.dsi.fastutil.booleans.BooleanCollection
add, add, addAll, contains, contains, containsAll, rem, remove, removeAll, removeIf, removeIf, retainAll, toArray, toBooleanArray, toBooleanArray
-
-
-
-
Field Detail
-
bitVector
protected final BitVector bitVector
The underlying bit vector.
-
from
protected final long from
The initial bit (inclusive).
-
to
protected long to
The final bit (not inclusive).
-
-
Constructor Detail
-
SubBitVector
public SubBitVector(BitVector l, long from, long to)
-
-
Method Detail
-
getBoolean
public boolean getBoolean(long index)
- Specified by:
getBooleanin interfaceit.unimi.dsi.fastutil.booleans.BooleanBigList
-
getInt
public int getInt(long index)
Description copied from interface:BitVectorReturns the value of the specified bit as an integer.This method is a useful synonym for
BooleanBigList.getBoolean(long).- Specified by:
getIntin interfaceBitVector- Overrides:
getIntin classAbstractBitVector- Parameters:
index- the index of a bit.- Returns:
- the value of the specified bit as an integer (0 or 1).
-
set
public boolean set(long index, boolean value)- Specified by:
setin interfaceit.unimi.dsi.fastutil.booleans.BooleanBigList- Overrides:
setin classAbstractBitVector
-
set
public void set(long index, int value)Description copied from interface:BitVectorSets the value of the specified bit as an integer (optional operation).This method is a useful synonym for
BooleanBigList.set(long, boolean).- Specified by:
setin interfaceBitVector- Overrides:
setin classAbstractBitVector- Parameters:
index- the index of a bit.value- the new value (any nonzero integer for setting the bit, zero for clearing the bit).
-
add
public void add(long index, boolean value)- Specified by:
addin interfaceit.unimi.dsi.fastutil.booleans.BooleanBigList- Overrides:
addin classAbstractBitVector
-
add
public void add(long index, int value)Description copied from interface:BitVectorAdds a bit with specified integer value at the specified index (optional operation).This method is a useful synonym for
BooleanBigList.add(long, boolean).- Specified by:
addin interfaceBitVector- Overrides:
addin classAbstractBitVector- Parameters:
index- the index of a bit.value- the value that will be inserted at positionindex(any nonzero integer for a true bit, zero for a false bit).
-
add
public void add(int value)
Description copied from interface:BitVectorAdds a bit with specified value at the end of this bit vector.This method is a useful synonym for
BooleanList.add(boolean).- Specified by:
addin interfaceBitVector- Overrides:
addin classAbstractBitVector- Parameters:
value- the new value (any nonzero integer for a true bit, zero for a false bit).
-
removeBoolean
public boolean removeBoolean(long index)
- Specified by:
removeBooleanin interfaceit.unimi.dsi.fastutil.booleans.BooleanBigList- Overrides:
removeBooleanin classAbstractBitVector
-
copy
public BitVector copy(long from, long to)
Description copied from interface:BitVectorReturns a copy of a part of this bit vector.- Specified by:
copyin interfaceBitVector- Overrides:
copyin classAbstractBitVector- Parameters:
from- the starting bit, inclusive.to- the ending bit, not inclusive.- Returns:
- a copy of the part of this bit vector going from bit
from(inclusive) to bitto(not inclusive)
-
subVector
public BitVector subVector(long from, long to)
Description copied from interface:BitVectorReturns a subvector view specified by initial and final index.The object returned by this method is a bit vector representing a view of this bit vector restricted to the given indices. Changes to the subvector will be reflected in the main vector.
- Specified by:
subVectorin interfaceBitVector- Overrides:
subVectorin classAbstractBitVector- Parameters:
from- the first index (inclusive).to- the last index (not inclusive).- Returns:
- a subvector view specified by initial and final index.
-
getLong
public long getLong(long from, long to)Description copied from interface:BitVectorReturns the specified bit range as a long.Note that bit 0 of the returned long will be bit
fromof this bit vector.Implementations are invited to provide high-speed implementations for the case in which
fromis a multiple ofLong.SIZEandtoisfrom+Long.SIZE(or less, in case the vector length is exceeded). This behaviour make it possible to implement high-speed hashing, copies, etc.- Specified by:
getLongin interfaceBitVector- Overrides:
getLongin classAbstractBitVector- Parameters:
from- the starting bit (inclusive).to- the ending bit (exclusive).- Returns:
- the long value contained in the specified bits.
-
asLongSet
public it.unimi.dsi.fastutil.longs.LongSortedSet asLongSet()
Description copied from interface:BitVectorReturns a view of this bit vector as a sorted set of long integers.More formally, this bit vector is infinitely extended to the left with zeros (e.g., all bits beyond
BitVector.length(long)are considered zeroes). The resulting infinite string is interpreted as the characteristic function of a set of integers.Note that, in particular, the resulting string representation is exactly that of a
BitSet.- Specified by:
asLongSetin interfaceBitVector- Overrides:
asLongSetin classAbstractBitVector- Returns:
- a view of this bit vector as a sorted set of long integers.
-
length
public long length()
Description copied from interface:BitVectorReturns the number of bits in this bit vector.If the number of bits in this bit vector is smaller than or equal to
Integer.MAX_VALUE, this method is semantically equivalent toList.size(). In any case, this method is semantically equivalent toSize64.size64(), but it is prefererred.
-
size64
public long size64()
Description copied from class:AbstractBitVector- Specified by:
size64in interfaceit.unimi.dsi.fastutil.Size64- Overrides:
size64in classAbstractBitVector
-
-