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


Java TLongLongHashMap.put方法代码示例

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


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

示例1: handleMessage

import gnu.trove.map.hash.TLongLongHashMap; //导入方法依赖的package包/类
final void handleMessage( final String json )
{
	final FragmentSegmentLutMessage lutMsg = gson.fromJson( json, FragmentSegmentLutMessage.class );

	System.out.println( "Message received" );
	System.out.println( gson.toJson( lutMsg ) );

	final TLongLongHashMap lut = new TLongLongHashMap();
	final long[] fragments = lutMsg.data.fragments;
	final long[] segments = lutMsg.data.segments;
	final int n = Math.min( fragments.length, segments.length );
	for ( int i = 0; i < n; ++i )
		lut.put( fragments[ i ], segments[ i ] );

	assignment.initLut( lut );
	viewer.requestRepaint();
}
 
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:18,代码来源:AgglomerationClientController.java

示例2: loadLong2LongGZMap

import gnu.trove.map.hash.TLongLongHashMap; //导入方法依赖的package包/类
public static TLongLongHashMap loadLong2LongGZMap(String mapFile, boolean reverse) throws IOException {
    long time = System.currentTimeMillis();
    TLongLongHashMap idMap = new TLongLongHashMap();
    BufferedReader br = new BufferedReader(new InputStreamReader(new GZIPInputStream(new FileInputStream(mapFile))));
    String line;
    String[] parts;

    while ((line = br.readLine()) != null) {
        parts = line.split(SEP);
        if (!reverse) {
            idMap.put(Long.parseLong(parts[0]), Long.parseLong(parts[1]));
        } else {
            idMap.put(Long.parseLong(parts[1]), Long.parseLong(parts[0]));
        }
    }

    logger.info(((System.currentTimeMillis() - time) / 1000d) + "s");
    return idMap;
}
 
开发者ID:giovanni-stilo,项目名称:G,代码行数:20,代码来源:TxtGraphUtils.java

示例3: loadLongLongLut

import gnu.trove.map.hash.TLongLongHashMap; //导入方法依赖的package包/类
/**
 * Load a long to long lookup table from an HDF5 dataset
 *
 * @param reader
 * @param dataset
 * @param blockSize
 */
static public TLongLongHashMap loadLongLongLut(
		final IHDF5Reader reader,
		final String dataset,
		final int blockSize )
{
	final IHDF5LongReader uint64Reader = reader.uint64();

	if ( !reader.exists( dataset ) )
		return null;

	final long[] dimensions = reader.object().getDimensions( dataset );
	if ( !( dimensions.length == 2 && dimensions[ 0 ] == 2 ) )
	{
		System.err.println( "LUT is not a lookup table, dimensions = " + Arrays.toString( dimensions ) );
		return null;
	}

	final long size = dimensions[ 1 ];

	final TLongLongHashMap lut = new TLongLongHashMap(
			Constants.DEFAULT_CAPACITY,
			Constants.DEFAULT_LOAD_FACTOR,
			Label.TRANSPARENT,
			Label.TRANSPARENT );

	for ( int offset = 0; offset < size; offset += blockSize )
	{
		final MDLongArray block = uint64Reader.readMDArrayBlockWithOffset(
				dataset,
				new int[]{ 2, ( int )Math.min( blockSize, size - offset ) },
				new long[]{ 0, offset } );

		for ( int i = 0; i < block.size( 1 ); ++i )
			lut.put( block.get( 0, i ), block.get( 1, i ) );

	}

	return lut;
}
 
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:47,代码来源:H5Utils.java

示例4: testTroveLongLongMap

import gnu.trove.map.hash.TLongLongHashMap; //导入方法依赖的package包/类
public int testTroveLongLongMap() {
	final TLongLongHashMap map = new TLongLongHashMap(initialSize, loadFactor, NULL, NULL);   
	int errors = 0;
   	for(int i = 0; i < maxSize; i++) {
   		map.put(i, i);
   	}
   	for(int i = 0; i < maxSize; i++) {
   		long x = map.get(i);
   		if(x!=i) {
   			errors++;
   		}
   	}
   	return errors;
   	//log("Done: %s, errors: %s", map.size(), errors);
}
 
开发者ID:nickman,项目名称:UnsafeAdapter,代码行数:16,代码来源:BenchmarkTroveLongLongMap.java

示例5: L_HammingLongs

import gnu.trove.map.hash.TLongLongHashMap; //导入方法依赖的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

示例6: convertTextGraphAndCreateLongMapGZ

import gnu.trove.map.hash.TLongLongHashMap; //导入方法依赖的package包/类
public static void convertTextGraphAndCreateLongMapGZ(String inputGraph, String outputGraph, String mapFile) throws IOException {
    int count = 1;
    TLongLongHashMap map = new TLongLongHashMap();
    long time = System.currentTimeMillis();

    BufferedReader br = new BufferedReader(new InputStreamReader(new GZIPInputStream(new FileInputStream(inputGraph))));
    BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new GZIPOutputStream(new FileOutputStream(outputGraph))));

    String line, newLine;
    long id1, id2, tId1, tId2;
    String[] parts;

    while ((line = br.readLine()) != null) {
        parts = line.split(SEP);
        tId1 = Long.parseLong(parts[0]);
        tId2 = Long.parseLong(parts[1]);

        if (!map.contains(tId1)) {
            map.put(tId1, count);
            count++;
        }

        if (!map.contains(tId2)) {
            map.put(tId2, count);
            count++;
        }

        id1 = map.get(tId1);
        id2 = map.get(tId2);
        if (id1 != 0 && id2 != 0) {
            newLine = "" + id1 + SEP + id2 + (parts.length > 2 ? (SEP + parts[2]) : "");
            bw.write(newLine);
            bw.newLine();
        }
    }
    bw.flush();
    bw.close();

    br.close();
    TxtGraphUtils.saveLongLongList(mapFile, map);

    logger.info(((System.currentTimeMillis() - time) / 1000d) + "s");
}
 
开发者ID:giovanni-stilo,项目名称:G,代码行数:44,代码来源:TxtGraphUtils.java


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