当前位置: 首页>>代码示例>>Java>>正文


Java TLongIntHashMap.put方法代码示例

本文整理汇总了Java中gnu.trove.map.hash.TLongIntHashMap.put方法的典型用法代码示例。如果您正苦于以下问题:Java TLongIntHashMap.put方法的具体用法?Java TLongIntHashMap.put怎么用?Java TLongIntHashMap.put使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gnu.trove.map.hash.TLongIntHashMap的用法示例。


在下文中一共展示了TLongIntHashMap.put方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testChangeNoEntryValues

import gnu.trove.map.hash.TLongIntHashMap; //导入方法依赖的package包/类
@Test
public void testChangeNoEntryValues() {
	//@formatter:off
	TLongIntHashMap map = new TLongIntHashMap(
			Constants.DEFAULT_CAPACITY, 
			Constants.DEFAULT_LOAD_FACTOR, 
			-1L, // no-key value 
			-1 // no entry value
	);
	//@formatter:on

	map.put(4, 2);
	Assert.assertEquals(-1L, map.getNoEntryKey());
	Assert.assertEquals(-1, map.getNoEntryValue());
	Assert.assertEquals(-1, map.get(5L));
	Assert.assertEquals(2, map.get(4L));
	Assert.assertTrue(map.contains(4));
	Assert.assertFalse(map.contains(5));
}
 
开发者ID:GreenDelta,项目名称:olca-modules,代码行数:20,代码来源:TroveTests.java

示例2: addResultToMap

import gnu.trove.map.hash.TLongIntHashMap; //导入方法依赖的package包/类
public static void addResultToMap(TLongIntHashMap results, TLongIntHashMap resultsToAdd) {
	long[] resultsToAddKeys = resultsToAdd.keys();
	int[] resultsToAddValues = resultsToAdd.values();

	for (int i = 0; i < resultsToAddKeys.length; i++) {
		int count = 0;

		if (results.contains(resultsToAddKeys[i])) {
			count = results.get(resultsToAddKeys[i]);
		}
		count += resultsToAddValues[i];
		results.put(resultsToAddKeys[i], count);
	}
}
 
开发者ID:networkdowntime,项目名称:EmbeddableSearch,代码行数:15,代码来源:SearchHistogramUtil.java

示例3: Alphabet

import gnu.trove.map.hash.TLongIntHashMap; //导入方法依赖的package包/类
public Alphabet(Alphabet a)
{
	numEntries = a.numEntries;
	map = new TLongIntHashMap(numEntries);    	
	for (TLongIntIterator iter = a.map.iterator(); iter.hasNext();) {
		iter.advance();
		map.put(iter.key(), iter.value());
	}
}
 
开发者ID:taolei87,项目名称:SRLParser,代码行数:10,代码来源:Alphabet.java

示例4: L_HammingLongs

import gnu.trove.map.hash.TLongIntHashMap; //导入方法依赖的package包/类
public L_HammingLongs(File file) throws Exception {
  	
DataInputStream in = new DataInputStream(new BufferedInputStream(
		new FileInputStream(file)));

  	File bFile = new File(file.getAbsolutePath() + ".b");    	
bucketsRAF = new RandomAccessFile(bFile, "r");		
fileChannel = bucketsRAF.getChannel();

  	h = in.readInt();
  	nh = 1 << h;
  	g = new G_HammingLongs(in);
  	
  	int nNotNulls = in.readInt();

  	//bSize = new int[nh];
  	//bucketOffset = new long[nh];
  	bSize = new TLongIntHashMap();;
  	bucketOffset = new TLongLongHashMap();
  	long offsetAcc = 0;
  	
  	for ( int i=0; i<nNotNulls; i++ ) {
	int ib = in.readInt();
  		int csize =  in.readInt();
	
  		//bSize[ib] = csize;
  		//bucketOffset[ib] = offsetAcc;
  		
  		bSize.put(ib, csize);
	bucketOffset.put(ib, offsetAcc);
	if (csize != 0) {
		offsetAcc += csize * Integer.BYTES; 
	}
}

in.close();

  }
 
开发者ID:ffalchi,项目名称:it.cnr.isti.vir,代码行数:39,代码来源:L_HammingLongs.java

示例5: loadArrayLevel0

import gnu.trove.map.hash.TLongIntHashMap; //导入方法依赖的package包/类
@Override
	public VolatileLabelMultisetArray loadArrayLevel0(
			final int[] dimensions,
			final long[] min ) throws InterruptedException
	{
		int[] data = null;

		final MDIntArray block = reader.readMDArrayBlockWithOffset(
				dataset,
				new int[]{ dimensions[ 2 ], dimensions[ 1 ], dimensions[ 0 ] },
				new long[]{ min[ 2 ], min[ 1 ], min[ 0 ] } );

		data = block.getAsFlatArray();

		if ( data == null )
		{
			System.out.println(
					"H5 short label multiset array loader failed loading min = " +
					Arrays.toString( min ) +
					", dimensions = " +
					Arrays.toString( dimensions ) );

			data = new int[ dimensions[ 0 ] * dimensions[ 1 ] * dimensions[ 2 ] ];
		}

		final int[] offsets = new int[ dimensions[ 2 ] * dimensions[ 1 ] * dimensions[ 0 ] ];
		final LongMappedAccessData listData = LongMappedAccessData.factory.createStorage( 32 );
		final LabelMultisetEntryList list = new LabelMultisetEntryList( listData, 0 );
		final LabelMultisetEntry entry = new LabelMultisetEntry( 0, 1 );
		int nextListOffset = 0;
		final TLongIntHashMap idOffsetHash = new TLongIntHashMap(
				Constants.DEFAULT_CAPACITY,
				Constants.DEFAULT_LOAD_FACTOR,
				-1,
				-1);
A:		for ( int i = 0; i < data.length; ++i )
		{
			final long id = data[ i ] & 0xffffffffL;

			final int offset = idOffsetHash.get( id );
			if ( offset == idOffsetHash.getNoEntryValue() )
			{
				list.createListAt( listData, nextListOffset );
				entry.setId( id );
				list.add( entry );
				offsets[ i ] = nextListOffset;
				idOffsetHash.put( id, nextListOffset );
				nextListOffset += list.getSizeInBytes();
			}
			else
			{
				offsets[ i ] = offset;
				continue A;
			}
		}
//		System.out.println( listData.size() );

		return new VolatileLabelMultisetArray( offsets, listData, true );
	}
 
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:60,代码来源:H5IntLabelMultisetArrayLoader.java

示例6: loadArrayLevel0

import gnu.trove.map.hash.TLongIntHashMap; //导入方法依赖的package包/类
@Override
	public VolatileLabelMultisetArray loadArrayLevel0(
			final int[] dimensions,
			final long[] min ) throws InterruptedException
	{
		short[] data = null;

		final MDShortArray block = reader.readMDArrayBlockWithOffset(
				dataset,
				new int[]{ dimensions[ 2 ], dimensions[ 1 ], dimensions[ 0 ] },
				new long[]{ min[ 2 ], min[ 1 ], min[ 0 ] } );

		data = block.getAsFlatArray();

		if ( data == null )
		{
			System.out.println(
					"H5 short label multiset array loader failed loading min = " +
					Arrays.toString( min ) +
					", dimensions = " +
					Arrays.toString( dimensions ) );

			data = new short[ dimensions[ 0 ] * dimensions[ 1 ] * dimensions[ 2 ] ];
		}

		final int[] offsets = new int[ dimensions[ 2 ] * dimensions[ 1 ] * dimensions[ 0 ] ];
		final LongMappedAccessData listData = LongMappedAccessData.factory.createStorage( 32 );
		final LabelMultisetEntryList list = new LabelMultisetEntryList( listData, 0 );
		final LabelMultisetEntry entry = new LabelMultisetEntry( 0, 1 );
		int nextListOffset = 0;
		final TLongIntHashMap idOffsetHash = new TLongIntHashMap(
				Constants.DEFAULT_CAPACITY,
				Constants.DEFAULT_LOAD_FACTOR,
				-1,
				-1);
A:		for ( int i = 0; i < data.length; ++i )
		{
			final long id = data[ i ] & 0xffffL;

//			does the list [id x 1] already exist?
			final int offset = idOffsetHash.get( id );
			if ( offset == idOffsetHash.getNoEntryValue() )
			{
				list.createListAt( listData, nextListOffset );
				entry.setId( id );
				list.add( entry );
				offsets[ i ] = nextListOffset;
				idOffsetHash.put( id, nextListOffset );
				nextListOffset += list.getSizeInBytes();
			}
			else
			{
				offsets[ i ] = offset;
				continue A;
			}
		}
//		System.out.println( listData.size() );

		return new VolatileLabelMultisetArray( offsets, listData, true );
	}
 
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:61,代码来源:H5ShortLabelMultisetArrayLoader.java

示例7: loadArrayLevel0

import gnu.trove.map.hash.TLongIntHashMap; //导入方法依赖的package包/类
@Override
	public VolatileLabelMultisetArray loadArrayLevel0(
			final int[] dimensions,
			final long[] min ) throws InterruptedException
	{
		float[] data = null;

		final MDFloatArray block = reader.readMDArrayBlockWithOffset(
				dataset,
				new int[]{ dimensions[ 2 ], dimensions[ 1 ], dimensions[ 0 ] },
				new long[]{ min[ 2 ], min[ 1 ], min[ 0 ] } );

		data = block.getAsFlatArray();

		if ( data == null )
		{
			System.out.println(
					"H5 short label multiset array loader failed loading min = " +
					Arrays.toString( min ) +
					", dimensions = " +
					Arrays.toString( dimensions ) );

			data = new float[ dimensions[ 0 ] * dimensions[ 1 ] * dimensions[ 2 ] ];
		}

		final int[] offsets = new int[ dimensions[ 2 ] * dimensions[ 1 ] * dimensions[ 0 ] ];
		final LongMappedAccessData listData = LongMappedAccessData.factory.createStorage( 32 );
		final LabelMultisetEntryList list = new LabelMultisetEntryList( listData, 0 );
		final LabelMultisetEntry entry = new LabelMultisetEntry( 0, 1 );
		int nextListOffset = 0;
		final TLongIntHashMap idOffsetHash = new TLongIntHashMap(
				Constants.DEFAULT_CAPACITY,
				Constants.DEFAULT_LOAD_FACTOR,
				-1,
				-1);
A:		for ( int i = 0; i < data.length; ++i )
		{
			final long id = Float.floatToIntBits( data[ i ] ) & 0xffffffffL;

			final int offset = idOffsetHash.get( id );
			if ( offset == idOffsetHash.getNoEntryValue() )
			{
				list.createListAt( listData, nextListOffset );
				entry.setId( id );
				list.add( entry );
				offsets[ i ] = nextListOffset;
				idOffsetHash.put( id, nextListOffset );
				nextListOffset += list.getSizeInBytes();
			}
			else
			{
				offsets[ i ] = offset;
				continue A;
			}
		}
//		System.out.println( listData.size() );

		return new VolatileLabelMultisetArray( offsets, listData, true );
	}
 
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:60,代码来源:H5FloatLabelMultisetArrayLoader.java

示例8: loadArrayLevel0

import gnu.trove.map.hash.TLongIntHashMap; //导入方法依赖的package包/类
@Override
	public VolatileLabelMultisetArray loadArrayLevel0(
			final int[] dimensions,
			final long[] min ) throws InterruptedException
	{
		long[] data = null;

		final MDLongArray block = reader.readMDArrayBlockWithOffset(
				dataset,
				new int[]{ dimensions[ 2 ], dimensions[ 1 ], dimensions[ 0 ] },
				new long[]{ min[ 2 ], min[ 1 ], min[ 0 ] } );

		data = block.getAsFlatArray();

		if ( data == null )
		{
			System.out.println(
					"H5 long label multiset array loader failed loading min = " +
					Arrays.toString( min ) +
					", dimensions = " +
					Arrays.toString( dimensions ) );

			data = new long[ dimensions[ 0 ] * dimensions[ 1 ] * dimensions[ 2 ] ];
		}

		final int[] offsets = new int[ dimensions[ 2 ] * dimensions[ 1 ] * dimensions[ 0 ] ];
		final LongMappedAccessData listData = LongMappedAccessData.factory.createStorage( 32 );
		final LabelMultisetEntryList list = new LabelMultisetEntryList( listData, 0 );
		final LabelMultisetEntry entry = new LabelMultisetEntry( 0, 1 );
		int nextListOffset = 0;
		final TLongIntHashMap idOffsetHash = new TLongIntHashMap(
				Constants.DEFAULT_CAPACITY,
				Constants.DEFAULT_LOAD_FACTOR,
				-1,
				-1 );
A:		for ( int i = 0; i < data.length; ++i )
		{
			final long id = data[ i ];

//			does the list [id x 1] already exist?
			final int offset = idOffsetHash.get( id );
			if ( offset == idOffsetHash.getNoEntryValue() )
			{
				list.createListAt( listData, nextListOffset );
				entry.setId( id );
				list.add( entry );
				offsets[ i ] = nextListOffset;
				idOffsetHash.put( id, nextListOffset );
				nextListOffset += list.getSizeInBytes();
			}
			else
			{
				offsets[ i ] = offset;
				continue A;
			}
		}
//		System.out.println( listData.size() );

		return new VolatileLabelMultisetArray( offsets, listData, nextListOffset, true );
	}
 
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:61,代码来源:H5LongLabelMultisetArrayLoader.java


注:本文中的gnu.trove.map.hash.TLongIntHashMap.put方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。