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


Java BigArrays类代码示例

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


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

示例1: put

import it.unimi.dsi.fastutil.BigArrays; //导入依赖的package包/类
public int put( final long k, final int v ) {
	final long h = it.unimi.dsi.fastutil.HashCommon.murmurHash3( k );

	// The starting point.
	int displ = (int)( h & segmentMask );
	int base = (int)( ( h & mask ) >>> BigArrays.SEGMENT_SHIFT );

	// There's always an unused entry.
	while ( used[ base ][ displ ] ) {
		if ( k == key[ base ][ displ ] ) {
			final int oldValue = value[ base ][ displ ];
			value[ base ][ displ ] = v;
			return oldValue;
		}
		base = ( base + ( ( displ = ( displ + 1 ) & segmentMask ) == 0 ? 1 : 0 ) ) & baseMask;
	}

	used[ base ][ displ ] = true;
	key[ base ][ displ ] = k;
	value[ base ][ displ ] = v;

	if ( ++size >= maxFill ) rehash( 2 * n );
	return -1;
}
 
开发者ID:lhelwerd,项目名称:WebGraph,代码行数:25,代码来源:ScatteredArcsASCIIGraph.java

示例2: get

import it.unimi.dsi.fastutil.BigArrays; //导入依赖的package包/类
public int get( final long k ) {
	final long h = it.unimi.dsi.fastutil.HashCommon.murmurHash3( k );

	// The starting point.
	int displ = (int)( h & segmentMask );
	int base = (int)( ( h & mask ) >>> BigArrays.SEGMENT_SHIFT );

	// There's always an unused entry.
	while ( used[ base ][ displ ] ) {
		if ( k == key[ base ][ displ ] ) return value[ base ][ displ ];
		base = ( base + ( ( displ = ( displ + 1 ) & segmentMask ) == 0 ? 1 : 0 ) ) & baseMask;
	}

	return -1;
}
 
开发者ID:lhelwerd,项目名称:WebGraph,代码行数:16,代码来源:ScatteredArcsASCIIGraph.java

示例3: rehash

import it.unimi.dsi.fastutil.BigArrays; //导入依赖的package包/类
protected void rehash( final long newN ) {
	final boolean used[][] = this.used;
	final long key[][] = this.key;
	final int[][] value = this.value;
	final boolean newUsed[][] = BooleanBigArrays.newBigArray( newN );
	final long newKey[][] = LongBigArrays.newBigArray( newN );
	final int newValue[][] = IntBigArrays.newBigArray( newN );
	final long newMask = newN - 1;
	final int newSegmentMask = newKey[ 0 ].length - 1;
	final int newBaseMask = newKey.length - 1;

	int base = 0, displ = 0;
	long h;
	long k;

	for ( long i = size; i-- != 0; ) {

		while ( !used[ base ][ displ ] )
			base = ( base + ( ( displ = ( displ + 1 ) & segmentMask ) == 0 ? 1 : 0 ) );

		k = key[ base ][ displ ];
		h = it.unimi.dsi.fastutil.HashCommon.murmurHash3( k );

		// The starting point.
		int d = (int)( h & newSegmentMask );
		int b = (int)( ( h & newMask ) >>> BigArrays.SEGMENT_SHIFT );

		while ( newUsed[ b ][ d ] )
			b = ( b + ( ( d = ( d + 1 ) & newSegmentMask ) == 0 ? 1 : 0 ) ) & newBaseMask;

		newUsed[ b ][ d ] = true;
		newKey[ b ][ d ] = k;
		newValue[ b ][ d ] = value[ base ][ displ ];

		base = ( base + ( ( displ = ( displ + 1 ) & segmentMask ) == 0 ? 1 : 0 ) );
	}

	this.n = newN;
	this.key = newKey;
	this.value = newValue;
	this.used = newUsed;
	initMasks();
	maxFill = maxFill( n, f );
}
 
开发者ID:lhelwerd,项目名称:WebGraph,代码行数:45,代码来源:ScatteredArcsASCIIGraph.java


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