org.limewire.collection
Class NotView
java.lang.Object
org.limewire.collection.NotView
- All Implemented Interfaces:
- BitField
public class NotView
- extends java.lang.Object
- implements BitField
Provides a not view for a BitField.
See not for more
information.
void sampleCodeNotView(){
BitSet bs1 = new BitSet();
bs1.set(0);
bs1.set(1);
BitField bf1 = new BitFieldSet(bs1, 5);
printBitField(bf1, "bf1");
NotView nv = new NotView(bf1);
printBitField(nv, " nv");
}
void printBitField(BitField bf, String bfName){
System.out.print(bfName + ": ");
for(int i = 0; i < bf.maxSize(); i++){
int j = 0;
if(bf.get(i))
j = 1;
System.out.print(j);
}
System.out.println("");
}
Output:
bf1: 11000
nv: 00111
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NotView
public NotView(BitField bf)
cardinality
public int cardinality()
- Specified by:
cardinality in interface BitField
get
public boolean get(int i)
- Specified by:
get in interface BitField
maxSize
public int maxSize()
- Specified by:
maxSize in interface BitField
nextClearBit
public int nextClearBit(int i)
- Specified by:
nextClearBit in interface BitField
nextSetBit
public int nextSetBit(int i)
- Specified by:
nextSetBit in interface BitField
- Returns:
- index of next set bit from index
i or -1 if there is no bit left
Copyright © 2009 Lime Wire LLC. All Rights Reserved.