Java Code Examples for it.unimi.dsi.bits.LongArrayBitVector#of()

The following examples show how to use it.unimi.dsi.bits.LongArrayBitVector#of() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LongArrayBitVectorTest.java    From database with GNU General Public License v2.0 5 votes vote down vote up
public void testHashCodeConsistency() {
	LongArrayBitVector b = LongArrayBitVector.of( 0, 1, 1, 0, 0, 1 );
	assertEquals( BooleanListBitVector.getInstance().replace( b ).hashCode(), b.hashCode() );
	b = LongArrayBitVector.wrap( new long[]{ 0x234598729872983L, 0x234598729872983L, 0x234598729872983L, 0xFFFF }, 222 );
	assertEquals( BooleanListBitVector.getInstance().replace( b ).hashCode(), b.hashCode() );
	assertEquals( BitVectors.EMPTY_VECTOR.hashCode(), b.length( 0 ).hashCode() );
}
 
Example 2
Source File: AbstractBitVectorTest.java    From database with GNU General Public License v2.0 5 votes vote down vote up
public void testCompareTo() {
	MinimalAlternatingBitVector v = new MinimalAlternatingBitVector();
	LongArrayBitVector w = LongArrayBitVector.copy( v );
	assertEquals( 0, w.compareTo( v ) );
	assertEquals( 0, v.compareTo( w ) );
	w.set( 100 );
	assertEquals( 1, w.compareTo( v ) );
	assertEquals( -1, v.compareTo( w ) );
	w = LongArrayBitVector.ofLength( 10 );
	assertEquals( -1, w.compareTo( v ) );
	assertEquals( 1, v.compareTo( w ) );
	w = LongArrayBitVector.of( 1 );
	assertEquals( 1, w.compareTo( v ) );
	assertEquals( -1, v.compareTo( w ) );
}
 
Example 3
Source File: PrefixFreeTransformationStrategyTest.java    From database with GNU General Public License v2.0 5 votes vote down vote up
public void testGetBoolean() {
	LongArrayBitVector v = LongArrayBitVector.of( 0, 1, 0 );
	TransformationStrategy<BitVector> prefixFree = TransformationStrategies.prefixFree();
	BitVector p = prefixFree.toBitVector( v );
	assertTrue( p.getBoolean( 0 ) );
	assertFalse( p.getBoolean( 1 ) );
	assertTrue( p.getBoolean( 2 ) );
	assertTrue( p.getBoolean( 3 ) );
	assertTrue( p.getBoolean( 4 ) );
	assertFalse( p.getBoolean( 5 ) );
	assertFalse( p.getBoolean( 6 ) );
	assertEquals( LongArrayBitVector.of(  1, 0, 1, 1, 1, 0, 0 ), p );
}
 
Example 4
Source File: LongArrayBitVectorTest.java    From database with GNU General Public License v2.0 4 votes vote down vote up
public void testReplaceLongArrayBitVector() {
	LongArrayBitVector b = LongArrayBitVector.of( 0, 1, 1 );
	assertEquals( b, LongArrayBitVector.getInstance().replace( b ) );
}