java nextprime_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

​點讚 3

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,

示例2: postInsertHook

​點讚 3

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,

示例3: postInsertHook

​點讚 3

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,

示例4: setUp

​點讚 2

import gnu.trove.impl.PrimeFinder; //導入方法依賴的package包/類

/**

* initializes the hashtable to a prime capacity which is at least

* initialCapacity + 1.

*

* @param initialCapacity an int 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,

示例5: setUp

​點讚 2

import gnu.trove.impl.PrimeFinder; //導入方法依賴的package包/類

/**

* initializes the hashtable to a prime capacity which is at least

* initialCapacity + 1.

*

* @param initialCapacity an int 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,

示例6: setUp

​點讚 2

import gnu.trove.impl.PrimeFinder; //導入方法依賴的package包/類

/**

* initializes the hashtable to a prime capacity which is at least

* initialCapacity + 1.

*

* @param initialCapacity an int 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,

示例7: setUp

​點讚 2

import gnu.trove.impl.PrimeFinder; //導入方法依賴的package包/類

/**

* initializes the hashtable to a prime capacity which is at least

* initialCapacity + 1.

*

* @param initialCapacity an int 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,

示例8: testPrimeFinder

​點讚 2

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,

示例9: testLargeCapacity

​點讚 2

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,

示例10: testMaxValue

​點讚 2

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,

注:本文中的gnu.trove.impl.PrimeFinder.nextPrime方法示例整理自Github/MSDocs等源碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值