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


Java PrimeFinder.nextPrime方法代码示例

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


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

示例1: postInsertHook

import gnu.trove.impl.PrimeFinder; //导入方法依赖的package包/类
/**
 * After an insert, this hook is called to adjust the size/free
 * values of the set and to perform rehashing if necessary.
 *
 * @param usedFreeSlot the slot
 */
protected final void postInsertHook( boolean usedFreeSlot ) {
    if ( usedFreeSlot ) {
        _free--;
    }

    // rehash whenever we exhaust the available space in the table
    if ( ++_size > _maxSize || _free == 0 ) {
        // choose a new capacity suited to the new state of the table
        // if we've grown beyond our maximum size, double capacity;
        // if we've exhausted the free spots, rehash to the same capacity,
        // which will free up any stale removed slots for reuse.
        int newCapacity = _size > _maxSize ? PrimeFinder.nextPrime( capacity() << 1 ) : capacity();
        rehash( newCapacity );
        computeMaxSize( capacity() );
    }
}
 
开发者ID:JianpingZeng,项目名称:xcc,代码行数:23,代码来源:THash.java

示例2: postInsertHook

import gnu.trove.impl.PrimeFinder; //导入方法依赖的package包/类
/**
 * After an insert, this hook is called to adjust the size/free
 * values of the set and to perform rehashing if necessary.
 *
 * @param usedFreeSlot the slot
 */
protected final void postInsertHook(final boolean usedFreeSlot ) {
    if ( usedFreeSlot ) {
        _free--;
    }

    // rehash whenever we exhaust the available space in the table
    if ( ++_size > _maxSize || _free == 0 ) {
        // choose a new capacity suited to the new state of the table
        // if we've grown beyond our maximum size, double capacity;
        // if we've exhausted the free spots, rehash to the same capacity,
        // which will free up any stale removed slots for reuse.
        final int newCapacity = _size > _maxSize ? PrimeFinder.nextPrime( capacity() << 1 ) : capacity();
        rehash( newCapacity );
        computeMaxSize( capacity() );
    }
}
 
开发者ID:digitalheir,项目名称:java-probabilistic-earley-parser,代码行数:23,代码来源:THash.java

示例3: postInsertHook

import gnu.trove.impl.PrimeFinder; //导入方法依赖的package包/类
/**
 * After an insert, this hook is called to adjust the size/free
 * values of the set and to perform rehashing if necessary.
 *
 * @param usedFreeSlot the slot
 */
protected final void postInsertHook( boolean usedFreeSlot ) {
	if ( usedFreeSlot ) {
		_free--;
	}

	// rehash whenever we exhaust the available space in the table
	if ( ++_size > _maxSize || _free == 0 ) {
		// choose a new capacity suited to the new state of the table
		// if we've grown beyond our maximum size, double capacity;
		// if we've exhausted the free spots, rehash to the same capacity,
		// which will free up any stale removed slots for reuse.
		int newCapacity = _size > _maxSize ? PrimeFinder.nextPrime( capacity() << 1 ) : capacity();
		rehash( newCapacity );
		computeMaxSize( capacity() );
	}
}
 
开发者ID:cinquin,项目名称:mutinack,代码行数:23,代码来源:THash0.java

示例4: setUp

import gnu.trove.impl.PrimeFinder; //导入方法依赖的package包/类
/**
 * initializes the hashtable to a prime capacity which is at least
 * <tt>initialCapacity + 1</tt>.
 *
 * @param initialCapacity an <code>int</code> value
 * @return the actual capacity chosen
 */
protected int setUp( int initialCapacity ) {
    int capacity;

    capacity = PrimeFinder.nextPrime( initialCapacity );
    computeMaxSize( capacity );
    computeNextAutoCompactionAmount( initialCapacity );

    return capacity;
}
 
开发者ID:JianpingZeng,项目名称:xcc,代码行数:17,代码来源:THash.java

示例5: setUp

import gnu.trove.impl.PrimeFinder; //导入方法依赖的package包/类
/**
 * initializes the hashtable to a prime capacity which is at least
 * <tt>initialCapacity + 1</tt>.
 *
 * @param initialCapacity an <code>int</code> value
 * @return the actual capacity chosen
 */
int setUp(final int initialCapacity) {
    final int capacity;

    capacity = PrimeFinder.nextPrime( initialCapacity );
    computeMaxSize( capacity );
    computeNextAutoCompactionAmount( initialCapacity );

    return capacity;
}
 
开发者ID:digitalheir,项目名称:java-probabilistic-earley-parser,代码行数:17,代码来源:THash.java

示例6: setUp

import gnu.trove.impl.PrimeFinder; //导入方法依赖的package包/类
/**
 * initializes the hashtable to a prime capacity which is at least
 * <tt>initialCapacity + 1</tt>.
 *
 * @param initialCapacity an <code>int</code> value
 * @return the actual capacity chosen
 */
protected int setUp( int initialCapacity ) {
    int capacity;

    capacity = PrimeFinder.nextPrime( initialCapacity );
    if ( capacity >= PrimeFinder.largestPrime ) {
        _loadFactor = 1.0f;
    }
    computeMaxSize( capacity );
    computeNextAutoCompactionAmount( initialCapacity );

    return capacity;
}
 
开发者ID:leventov,项目名称:trove-over-koloboke-compile,代码行数:20,代码来源:THash.java

示例7: setUp

import gnu.trove.impl.PrimeFinder; //导入方法依赖的package包/类
/**
 * initializes the hashtable to a prime capacity which is at least
 * <tt>initialCapacity + 1</tt>.
 *
 * @param initialCapacity an <code>int</code> value
 * @return the actual capacity chosen
 */
protected int setUp( int initialCapacity ) {
	int capacity;

	capacity = PrimeFinder.nextPrime( initialCapacity );
	if ( capacity >= PrimeFinder.largestPrime ) {
		_loadFactor = 1.0f;
	}
	computeMaxSize( capacity );
	computeNextAutoCompactionAmount( initialCapacity );

	return capacity;
}
 
开发者ID:cinquin,项目名称:mutinack,代码行数:20,代码来源:THash0.java

示例8: testPrimeFinder

import gnu.trove.impl.PrimeFinder; //导入方法依赖的package包/类
public void testPrimeFinder() throws Exception {
    int r = PrimeFinder.nextPrime(999999);
    assertEquals(1070981,r);
}
 
开发者ID:palantir,项目名称:trove-3.0.3,代码行数:5,代码来源:PrimeFinderTest.java

示例9: testLargeCapacity

import gnu.trove.impl.PrimeFinder; //导入方法依赖的package包/类
public void testLargeCapacity() {
    final int twentyFourBitPrime = PrimeFinder.nextPrime( 1 << 24 );
    TByteHashSet set = new TByteHashSet( twentyFourBitPrime + 1, 1.0f );

    assertTrue( "capacity was not large enough to hold desired elements" , set.capacity() > twentyFourBitPrime );
}
 
开发者ID:leventov,项目名称:trove-over-koloboke-compile,代码行数:7,代码来源:THashTest.java

示例10: testMaxValue

import gnu.trove.impl.PrimeFinder; //导入方法依赖的package包/类
public void testMaxValue() throws Exception {
    int r = PrimeFinder.nextPrime(Integer.MAX_VALUE);
    assertEquals(2004663929, r);
}
 
开发者ID:leventov,项目名称:trove-over-koloboke-compile,代码行数:5,代码来源:PrimeFinderTest.java


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