• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java BinIO类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中it.unimi.dsi.fastutil.io.BinIO的典型用法代码示例。如果您正苦于以下问题:Java BinIO类的具体用法?Java BinIO怎么用?Java BinIO使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



BinIO类属于it.unimi.dsi.fastutil.io包,在下文中一共展示了BinIO类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: main

import it.unimi.dsi.fastutil.io.BinIO; //导入依赖的package包/类
public static void main(String[] arg) throws IOException, JSAPException {
	final SimpleJSAP jsap = new SimpleJSAP(GZIPIndexer.class.getName(), "Computes and stores a quasi-succinct index for a compressed archive.",
			new Parameter[] {
				new UnflaggedOption("archive", JSAP.STRING_PARSER, JSAP.REQUIRED, "The name a GZIP's archive."),
				new UnflaggedOption("index", JSAP.STRING_PARSER, JSAP.REQUIRED, "The output (a serialized LongBigList of pointers to the records in the archive) filename."),
			}
	);

	final JSAPResult jsapResult = jsap.parse(arg);
	if (jsap.messagePrinted()) return;

	final FastBufferedInputStream input = new FastBufferedInputStream(new FileInputStream(jsapResult.getString("archive")));
	ProgressLogger pl = new ProgressLogger(LOGGER, 1, TimeUnit.MINUTES, "records");
	pl.start("Scanning...");
	final EliasFanoMonotoneLongBigList list = new EliasFanoMonotoneLongBigList(index(input, pl));
	pl.done();
	BinIO.storeObject(list, jsapResult.getString("index"));
}
 
开发者ID:LAW-Unimi,项目名称:BUbiNG,代码行数:19,代码来源:GZIPIndexer.java


示例2: main

import it.unimi.dsi.fastutil.io.BinIO; //导入依赖的package包/类
/**
 * Use with [hash] [queries]
 *
 * @param args input files
 * @throws Exception
 */
public static void main( String args[] ) throws Exception {
    double threshold = 0.001;
    QuasiSuccinctEntityHash hash = ( QuasiSuccinctEntityHash ) BinIO.loadObject( args[ 0 ] );
    BufferedReader lines = new BufferedReader( new FileReader( args[ 1 ] ) );
    FastEntityLinker fel = new FastEntityLinker( hash, new EmptyContext() );
    String q;
    int numberOfQueries = 0;
    long acumTime = 0;
    while( ( q = lines.readLine() ) != null ) {
        numberOfQueries++;
        if( q.length() == 0 ) continue;
        long time = -System.currentTimeMillis();
        try {
            fel.getResults( q, threshold );
        } catch( Exception e ) {

        }
        time += System.currentTimeMillis();
        acumTime += time;
        if( numberOfQueries % 10000 == 0 ) System.out.println( " #q = " + numberOfQueries + " " + ( ( double ) acumTime / numberOfQueries ) + " ms/q, time=" + acumTime );
    }
    lines.close();
    System.out.println( " #q = " + numberOfQueries + " " + ( ( double ) acumTime / numberOfQueries ) + " ms/q, time=" + acumTime );
}
 
开发者ID:yahoo,项目名称:FEL,代码行数:31,代码来源:MeasureSpeed.java


示例3: testSerialisation

import it.unimi.dsi.fastutil.io.BinIO; //导入依赖的package包/类
@Test
public void testSerialisation() throws IOException, ClassNotFoundException {
	// We can't really test reference maps as equals() doesnt' work
	ObjectArraySet<Integer> s = new ObjectArraySet<Integer>();
	ByteArrayOutputStream baos = new ByteArrayOutputStream();
	ObjectOutputStream oos = new ObjectOutputStream( baos );
	oos.writeObject( s );
	oos.close();
	assertEquals( s, BinIO.loadObject( new ByteArrayInputStream( baos.toByteArray() ) ) );
	
	s.add( new Integer( 0 ) );
	s.add( new Integer( 1 ) );

	baos.reset();
	oos = new ObjectOutputStream( baos );
	oos.writeObject( s );
	oos.close();
	assertEquals( s, BinIO.loadObject( new ByteArrayInputStream( baos.toByteArray() ) ) );
}
 
开发者ID:phishman3579,项目名称:fastutil,代码行数:20,代码来源:ReferenceArraySetTest.java


示例4: testSerialisation

import it.unimi.dsi.fastutil.io.BinIO; //导入依赖的package包/类
@Test
public void testSerialisation() throws IOException, ClassNotFoundException {
	// We can't really test reference maps as equals() doesnt' work
	Object2ObjectArrayMap<Integer, Integer> m = new Object2ObjectArrayMap<Integer, Integer>();
	ByteArrayOutputStream baos = new ByteArrayOutputStream();
	ObjectOutputStream oos = new ObjectOutputStream( baos );
	oos.writeObject( m );
	oos.close();
	assertEquals( m, BinIO.loadObject( new ByteArrayInputStream( baos.toByteArray() ) ) );
	
	m.put( new Integer( 0 ), new Integer( 1 ) );
	m.put( new Integer( 1 ), new Integer( 2 ) );

	baos.reset();
	oos = new ObjectOutputStream( baos );
	oos.writeObject( m );
	oos.close();
	assertEquals( m, BinIO.loadObject( new ByteArrayInputStream( baos.toByteArray() ) ) );
}
 
开发者ID:phishman3579,项目名称:fastutil,代码行数:20,代码来源:Reference2ReferenceArrayMapTest.java


示例5: testSerialisation

import it.unimi.dsi.fastutil.io.BinIO; //导入依赖的package包/类
@Test
public void testSerialisation() throws IOException, ClassNotFoundException {
	Int2IntArrayMap m = new Int2IntArrayMap();
	ByteArrayOutputStream baos = new ByteArrayOutputStream();
	ObjectOutputStream oos = new ObjectOutputStream( baos );
	oos.writeObject( m );
	oos.close();
	assertEquals( m, BinIO.loadObject( new ByteArrayInputStream( baos.toByteArray() ) ) );
	
	m.put( 0, 1 );
	m.put( 1, 2 );

	baos.reset();
	oos = new ObjectOutputStream( baos );
	oos.writeObject( m );
	oos.close();
	assertEquals( m, BinIO.loadObject( new ByteArrayInputStream( baos.toByteArray() ) ) );
}
 
开发者ID:phishman3579,项目名称:fastutil,代码行数:19,代码来源:Int2IntArrayMapTest.java


示例6: testSerialisation

import it.unimi.dsi.fastutil.io.BinIO; //导入依赖的package包/类
@Test
public void testSerialisation() throws IOException, ClassNotFoundException {
	IntArraySet s = new IntArraySet();
	ByteArrayOutputStream baos = new ByteArrayOutputStream();
	ObjectOutputStream oos = new ObjectOutputStream( baos );
	oos.writeObject( s );
	oos.close();
	assertEquals( s, BinIO.loadObject( new ByteArrayInputStream( baos.toByteArray() ) ) );
	
	s.add( 0 );
	s.add( 1 );

	baos.reset();
	oos = new ObjectOutputStream( baos );
	oos.writeObject( s );
	oos.close();
	assertEquals( s, BinIO.loadObject( new ByteArrayInputStream( baos.toByteArray() ) ) );
}
 
开发者ID:phishman3579,项目名称:fastutil,代码行数:19,代码来源:IntArraySetTest.java


示例7: testSerialization

import it.unimi.dsi.fastutil.io.BinIO; //导入依赖的package包/类
@Test
public void testSerialization() throws IOException, ClassNotFoundException {
	File temp = File.createTempFile( IntArrayFIFOQueueTest.class.getSimpleName() + "-", "-test" );
	temp.deleteOnExit();
	IntArrayFIFOQueue q = new IntArrayFIFOQueue();
	BinIO.storeObject( q, temp );
	assertSameQueue( q, (IntArrayFIFOQueue)BinIO.loadObject( temp ) );
	
	for( int i = 0; i < 100; i++ ) q.enqueue( i );
	BinIO.storeObject( q, temp );
	assertSameQueue( q, (IntArrayFIFOQueue)BinIO.loadObject( temp ) );

	q.trim();
	for( int i = 0; i < 128; i++ ) q.enqueue( i );
	BinIO.storeObject( q, temp );
	assertSameQueue( q, (IntArrayFIFOQueue)BinIO.loadObject( temp ) );

	temp.delete();
}
 
开发者ID:phishman3579,项目名称:fastutil,代码行数:20,代码来源:IntArrayFIFOQueueTest.java


示例8: testGammaValues

import it.unimi.dsi.fastutil.io.BinIO; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testGammaValues() throws IOException, ClassNotFoundException {
	for (final int size : new int[] { 100, 1000, 10000 }) {
		final String[] s = new String[size];
		for (int i = s.length; i-- != 0;)
			s[i] = Integer.toString(i);
		final long[] values = new long[size];
		GV3CompressedFunctionTest.generateGamma(values);
		GV4CompressedFunction<CharSequence> mph = new GV4CompressedFunction.Builder<CharSequence>().keys(Arrays.asList(s)).codec(new Codec.Huffman(20)).transform(TransformationStrategies.utf16()).values(LongArrayList.wrap(values)).build();
		check(size, s, mph, values);
		final File temp = File.createTempFile(getClass().getSimpleName(), "test");
		temp.deleteOnExit();
		BinIO.storeObject(mph, temp);
		mph = (GV4CompressedFunction<CharSequence>) BinIO.loadObject(temp);
		check(size, s, mph, values);
	}
}
 
开发者ID:vigna,项目名称:Sux4J,代码行数:19,代码来源:GV4CompressedFunctionTest.java


示例9: testUniformNumbers

import it.unimi.dsi.fastutil.io.BinIO; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testUniformNumbers() throws IOException, ClassNotFoundException {
	// TODO: restore working codec for size 1
	for (final int maxLength : new int[] { 2, 3, 4, 8, 16, 32, 64 }) {
		for (final int size : new int[] { 0, 1000, 10000 }) {
			final String[] s = new String[size];

			for (int i = s.length; i-- != 0;) s[i] = Integer.toString(i);
			final XoRoShiRo128PlusRandom r = new XoRoShiRo128PlusRandom(0);
			final long[] v = new long[size];
			for (int i = 0; i < size; i++) v[i] = r.nextInt(maxLength);
			final Codec codec = new Codec.Huffman();
			GV4CompressedFunction<CharSequence> mph = new GV4CompressedFunction.Builder<CharSequence>().keys(Arrays.asList(s)).codec(codec).transform(TransformationStrategies.utf16()).values(LongArrayList.wrap(v)).build();
			check(size, s, mph, v);
			final File temp = File.createTempFile(getClass().getSimpleName(), "test");
			temp.deleteOnExit();
			BinIO.storeObject(mph, temp);
			mph = (GV4CompressedFunction<CharSequence>) BinIO.loadObject(temp);

			check(size, s, mph, v);

		}
	}
}
 
开发者ID:vigna,项目名称:Sux4J,代码行数:26,代码来源:GV4CompressedFunctionTest.java


示例10: testGeometricValuesHuffman

import it.unimi.dsi.fastutil.io.BinIO; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testGeometricValuesHuffman() throws IOException, ClassNotFoundException {
	for (final int size : new int[] { 100, 1000, 10000 }) {
		final String[] s = new String[size];
		for (int i = s.length; i-- != 0;)
			s[i] = Integer.toString(i);
		final XoRoShiRo128PlusRandom r = new XoRoShiRo128PlusRandom(0);
		final long[] values = new long[size];
		for (int i = 0; i < size; i++) {
			values[i] = Integer.numberOfTrailingZeros(r.nextInt());
		}
		final Codec.Huffman cdc = new Codec.Huffman();
		GV4CompressedFunction<CharSequence> mph = new GV4CompressedFunction.Builder<CharSequence>().keys(Arrays.asList(s)).codec(cdc).transform(TransformationStrategies.utf16()).values(LongArrayList.wrap(values)).build();
		check(size, s, mph, values);
		final File temp = File.createTempFile(getClass().getSimpleName(), "test");
		temp.deleteOnExit();
		BinIO.storeObject(mph, temp);
		mph = (GV4CompressedFunction<CharSequence>) BinIO.loadObject(temp);
		check(size, s, mph, values);
	}

}
 
开发者ID:vigna,项目名称:Sux4J,代码行数:24,代码来源:GV4CompressedFunctionTest.java


示例11: testGeometricValuesLengthLimitedHuffman

import it.unimi.dsi.fastutil.io.BinIO; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testGeometricValuesLengthLimitedHuffman() throws IOException, ClassNotFoundException {
	for (final int size : new int[] { 100, 1000, 10000 }) {
		final String[] s = new String[size];
		for (int i = s.length; i-- != 0;)
			s[i] = Integer.toString(i);
		final XoRoShiRo128PlusRandom r = new XoRoShiRo128PlusRandom(0);
		final long[] values = new long[size];
		for (int i = 0; i < size; i++) {
			values[i] = Integer.numberOfTrailingZeros(r.nextInt());
		}
		System.err.println(Arrays.toString(values));
		final Codec.Huffman cdc = new Codec.Huffman(5);
		GV4CompressedFunction<CharSequence> mph = new GV4CompressedFunction.Builder<CharSequence>().keys(Arrays.asList(s)).codec(cdc).transform(TransformationStrategies.utf16()).values(LongArrayList.wrap(values)).build();
		check(size, s, mph, values);
		final File temp = File.createTempFile(getClass().getSimpleName(), "test");
		temp.deleteOnExit();
		BinIO.storeObject(mph, temp);
		mph = (GV4CompressedFunction<CharSequence>) BinIO.loadObject(temp);
		check(size, s, mph, values);
	}

}
 
开发者ID:vigna,项目名称:Sux4J,代码行数:25,代码来源:GV4CompressedFunctionTest.java


示例12: testGeometricValuesUnary

import it.unimi.dsi.fastutil.io.BinIO; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testGeometricValuesUnary() throws IOException, ClassNotFoundException {
	for (final int size : new int[] { 100, 1000, 10000 }) {
		final String[] s = new String[size];
		for (int i = s.length; i-- != 0;)
			s[i] = Integer.toString(i);
		final XoRoShiRo128PlusRandom r = new XoRoShiRo128PlusRandom(0);
		final long[] values = new long[size];
		for (int i = 0; i < size; i++) {
			values[i] = Integer.numberOfTrailingZeros(r.nextInt());
		}
		final Codec.Unary cdc = new Codec.Unary();
		GV4CompressedFunction<CharSequence> mph = new GV4CompressedFunction.Builder<CharSequence>().keys(Arrays.asList(s)).codec(cdc).transform(TransformationStrategies.utf16()).values(LongArrayList.wrap(values)).build();
		check(size, s, mph, values);
		final File temp = File.createTempFile(getClass().getSimpleName(), "test");
		temp.deleteOnExit();
		BinIO.storeObject(mph, temp);
		mph = (GV4CompressedFunction<CharSequence>) BinIO.loadObject(temp);
		check(size, s, mph, values);
	}

}
 
开发者ID:vigna,项目名称:Sux4J,代码行数:24,代码来源:GV4CompressedFunctionTest.java


示例13: testZipfianValuesLengthLimitedHuffman

import it.unimi.dsi.fastutil.io.BinIO; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testZipfianValuesLengthLimitedHuffman() throws IOException, ClassNotFoundException {
	for (final int size : new int[] { 100, 1000, 10000 }) {
		final String[] s = new String[size];
		for (int i = s.length; i-- != 0;)
			s[i] = Integer.toString(i);
		final XoRoShiRo128PlusRandomGenerator r = new XoRoShiRo128PlusRandomGenerator(0);
		final long[] values = new long[size];
		final ZipfDistribution z = new org.apache.commons.math3.distribution.ZipfDistribution(r, 100000, 2);
		for (int i = 0; i < size; i++) {
			values[i] = z.sample();
		}
		final Codec.Huffman cdc = new Codec.Huffman(100);
		GV4CompressedFunction<CharSequence> mph = new GV4CompressedFunction.Builder<CharSequence>().keys(Arrays.asList(s)).codec(cdc).transform(TransformationStrategies.utf16()).values(LongArrayList.wrap(values)).build();
		check(size, s, mph, values);
		final File temp = File.createTempFile(getClass().getSimpleName(), "test");
		temp.deleteOnExit();
		BinIO.storeObject(mph, temp);
		mph = (GV4CompressedFunction<CharSequence>) BinIO.loadObject(temp);
		check(size, s, mph, values);
	}

}
 
开发者ID:vigna,项目名称:Sux4J,代码行数:25,代码来源:GV4CompressedFunctionTest.java


示例14: testZipfianValuesGamma

import it.unimi.dsi.fastutil.io.BinIO; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testZipfianValuesGamma() throws IOException, ClassNotFoundException {
	for (final int size : new int[] { 100, 1000, 10000 }) {
		final String[] s = new String[size];
		for (int i = s.length; i-- != 0;)
			s[i] = Integer.toString(i);
		final XoRoShiRo128PlusRandomGenerator r = new XoRoShiRo128PlusRandomGenerator(0);
		final long[] values = new long[size];
		final ZipfDistribution z = new org.apache.commons.math3.distribution.ZipfDistribution(r, 100000, 2);
		for (int i = 0; i < size; i++) {
			values[i] = z.sample();
		}
		final Codec.Gamma cdc = new Codec.Gamma();
		GV4CompressedFunction<CharSequence> mph = new GV4CompressedFunction.Builder<CharSequence>().keys(Arrays.asList(s)).codec(cdc).transform(TransformationStrategies.utf16()).values(LongArrayList.wrap(values)).build();
		check(size, s, mph, values);
		final File temp = File.createTempFile(getClass().getSimpleName(), "test");
		temp.deleteOnExit();
		BinIO.storeObject(mph, temp);
		mph = (GV4CompressedFunction<CharSequence>) BinIO.loadObject(temp);
		check(size, s, mph, values);
	}

}
 
开发者ID:vigna,项目名称:Sux4J,代码行数:25,代码来源:GV4CompressedFunctionTest.java


示例15: testSortedNumbers

import it.unimi.dsi.fastutil.io.BinIO; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testSortedNumbers() throws IOException, ClassNotFoundException {

	String[] s = new String[10];
	long[] v = new long[s.length];
	for (int i = s.length; i-- != 0;)
		s[(int)(v[i] = i)] = binary(i);

	GOV3Function<String> function = new GOV3Function.Builder<String>().keys(Arrays.asList(s)).transform(TransformationStrategies.utf16()).values(LongArrayList.wrap(v), 12).build();

	int[] check = new int[s.length];
	Arrays.fill(check, -1);
	for (int i = s.length; i-- != 0;)
		assertEquals(i, function.getLong(s[i]));

	File temp = File.createTempFile(getClass().getSimpleName(), "test");
	temp.deleteOnExit();
	BinIO.storeObject(function, temp);
	function = (GOV3Function<String>)BinIO.loadObject(temp);
	for (int i = s.length; i-- != 0;)
		assertEquals(i, function.getLong(s[i]));
}
 
开发者ID:vigna,项目名称:Sux4J,代码行数:24,代码来源:HypergraphFunctionTest.java


示例16: testGammaValues

import it.unimi.dsi.fastutil.io.BinIO; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testGammaValues() throws IOException, ClassNotFoundException {
	for (final int size : new int[] { 100, 1000, 10000 }) {
		final String[] s = new String[size];
		for (int i = s.length; i-- != 0;) s[i] = Integer.toString(i);
		final long[] values = new long[size];
		generateGamma(values);
		GV3CompressedFunction<CharSequence> mph = new GV3CompressedFunction.Builder<CharSequence>().keys(Arrays.asList(s)).codec(new Codec.Huffman(20)).transform(TransformationStrategies.utf16()).values(LongArrayList.wrap(values)).build();
		check(size, s, mph, values);
		final File temp = File.createTempFile(getClass().getSimpleName(), "test");
		temp.deleteOnExit();
		BinIO.storeObject(mph, temp);
		mph = (GV3CompressedFunction<CharSequence>) BinIO.loadObject(temp);
		check(size, s, mph, values);
	}
}
 
开发者ID:vigna,项目名称:Sux4J,代码行数:18,代码来源:GV3CompressedFunctionTest.java


示例17: testGeometricValuesHuffman

import it.unimi.dsi.fastutil.io.BinIO; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testGeometricValuesHuffman() throws IOException, ClassNotFoundException {
	for (final int size : new int[] { 100, 1000, 10000 }) {
		final String[] s = new String[size];
		for (int i = s.length; i-- != 0;)
			s[i] = Integer.toString(i);
		final XoRoShiRo128PlusRandom r = new XoRoShiRo128PlusRandom(0);
		final long[] values = new long[size];
		for (int i = 0; i < size; i++) values[i] = Integer.numberOfTrailingZeros(r.nextInt());
		final Codec.Huffman cdc = new Codec.Huffman();
		GV3CompressedFunction<CharSequence> mph = new GV3CompressedFunction.Builder<CharSequence>().keys(Arrays.asList(s)).codec(cdc).transform(TransformationStrategies.utf16()).values(LongArrayList.wrap(values)).build();
		check(size, s, mph, values);
		final File temp = File.createTempFile(getClass().getSimpleName(), "test");
		temp.deleteOnExit();
		BinIO.storeObject(mph, temp);
		mph = (GV3CompressedFunction<CharSequence>) BinIO.loadObject(temp);
		check(size, s, mph, values);
	}

}
 
开发者ID:vigna,项目名称:Sux4J,代码行数:22,代码来源:GV3CompressedFunctionTest.java


示例18: testGeometricValuesLengthLimitedHuffman

import it.unimi.dsi.fastutil.io.BinIO; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testGeometricValuesLengthLimitedHuffman() throws IOException, ClassNotFoundException {
	for (final int size : new int[] { 100, 1000, 10000 }) {
		final String[] s = new String[size];
		for (int i = s.length; i-- != 0;)
			s[i] = Integer.toString(i);
		final XoRoShiRo128PlusRandom r = new XoRoShiRo128PlusRandom(0);
		final long[] values = new long[size];
		for (int i = 0; i < size; i++) {
			values[i] = Integer.numberOfTrailingZeros(r.nextInt());
		}
		final Codec.Huffman cdc = new Codec.Huffman(5);
		GV3CompressedFunction<CharSequence> mph = new GV3CompressedFunction.Builder<CharSequence>().keys(Arrays.asList(s)).codec(cdc).transform(TransformationStrategies.utf16()).values(LongArrayList.wrap(values)).build();
		check(size, s, mph, values);
		final File temp = File.createTempFile(getClass().getSimpleName(), "test");
		temp.deleteOnExit();
		BinIO.storeObject(mph, temp);
		mph = (GV3CompressedFunction<CharSequence>) BinIO.loadObject(temp);
		check(size, s, mph, values);
	}

}
 
开发者ID:vigna,项目名称:Sux4J,代码行数:24,代码来源:GV3CompressedFunctionTest.java


示例19: testGeometricValuesUnary

import it.unimi.dsi.fastutil.io.BinIO; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testGeometricValuesUnary() throws IOException, ClassNotFoundException {
	for (final int size : new int[] { 100, 1000, 10000 }) {
		final String[] s = new String[size];
		for (int i = s.length; i-- != 0;)
			s[i] = Integer.toString(i);
		final XoRoShiRo128PlusRandom r = new XoRoShiRo128PlusRandom(0);
		final long[] values = new long[size];
		for (int i = 0; i < size; i++) {
			values[i] = Integer.numberOfTrailingZeros(r.nextInt());
		}
		final Unary cdc = new Codec.Unary();
		GV3CompressedFunction<CharSequence> mph = new GV3CompressedFunction.Builder<CharSequence>().keys(Arrays.asList(s)).codec(cdc).transform(TransformationStrategies.utf16()).values(LongArrayList.wrap(values)).build();
		check(size, s, mph, values);
		final File temp = File.createTempFile(getClass().getSimpleName(), "test");
		temp.deleteOnExit();
		BinIO.storeObject(mph, temp);
		mph = (GV3CompressedFunction<CharSequence>) BinIO.loadObject(temp);
		check(size, s, mph, values);
	}

}
 
开发者ID:vigna,项目名称:Sux4J,代码行数:24,代码来源:GV3CompressedFunctionTest.java


示例20: testZipfianValuesLengthLimitedHuffman

import it.unimi.dsi.fastutil.io.BinIO; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testZipfianValuesLengthLimitedHuffman() throws IOException, ClassNotFoundException {
	for (final int size : new int[] { 100, 1000, 10000 }) {
		final String[] s = new String[size];
		for (int i = s.length; i-- != 0;)
			s[i] = Integer.toString(i);
		final XoRoShiRo128PlusRandomGenerator r = new XoRoShiRo128PlusRandomGenerator(0);
		final long[] values = new long[size];
		final ZipfDistribution z = new org.apache.commons.math3.distribution.ZipfDistribution(r, 100000, 2);
		for (int i = 0; i < size; i++) {
			values[i] = z.sample();
		}
		final Codec.Huffman cdc = new Codec.Huffman(6);
		GV3CompressedFunction<CharSequence> mph = new GV3CompressedFunction.Builder<CharSequence>().keys(Arrays.asList(s)).codec(cdc).transform(TransformationStrategies.utf16()).values(LongArrayList.wrap(values)).build();
		check(size, s, mph, values);
		final File temp = File.createTempFile(getClass().getSimpleName(), "test");
		temp.deleteOnExit();
		BinIO.storeObject(mph, temp);
		mph = (GV3CompressedFunction<CharSequence>) BinIO.loadObject(temp);
		check(size, s, mph, values);
	}

}
 
开发者ID:vigna,项目名称:Sux4J,代码行数:25,代码来源:GV3CompressedFunctionTest.java



注:本文中的it.unimi.dsi.fastutil.io.BinIO类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java GetParserOperation类代码示例发布时间:2022-05-23
下一篇:
Java ISourceLookupParticipant类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap