本文整理了Java中com.graphhopper.util.Helper.idealIntArraySize()
方法的一些代码示例,展示了Helper.idealIntArraySize()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Helper.idealIntArraySize()
方法的具体详情如下:
包路径:com.graphhopper.util.Helper
类名称:Helper
方法名:idealIntArraySize
暂无
代码示例来源:origin: graphhopper/graphhopper
/**
* Creates a new SparseIntIntArray containing no mappings that will not require any additional
* memory allocation to store the specified number of mappings.
*/
public SparseIntIntArray(int cap) {
try {
cap = Helper.idealIntArraySize(cap);
mKeys = new int[cap];
mValues = new int[cap];
mSize = 0;
} catch (OutOfMemoryError err) {
System.err.println("requested capacity " + cap);
throw err;
}
}
代码示例来源:origin: graphhopper/graphhopper
/**
* Puts a key/value pair into the array, optimizing for the case where the key is greater than
* all existing keys in the array.
*/
public int append(int key, int value) {
if (mSize != 0 && key <= mKeys[mSize - 1]) {
return put(key, value);
}
if (mGarbage && mSize >= mKeys.length) {
gc();
}
int pos = mSize;
if (pos >= mKeys.length) {
int n = Helper.idealIntArraySize(pos + 1);
int[] nkeys = new int[n];
int[] nvalues = new int[n];
System.arraycopy(mKeys, 0, nkeys, 0, mKeys.length);
System.arraycopy(mValues, 0, nvalues, 0, mValues.length);
mKeys = nkeys;
mValues = nvalues;
}
mKeys[pos] = key;
mValues[pos] = value;
mSize = pos + 1;
return pos;
}
代码示例来源:origin: graphhopper/graphhopper
int n = Helper.idealIntArraySize(mSize + 1);
代码示例来源:origin: com.graphhopper/graphhopper-core
/**
* Creates a new SparseIntIntArray containing no mappings that will not require any additional
* memory allocation to store the specified number of mappings.
*/
public SparseIntIntArray(int cap) {
try {
cap = Helper.idealIntArraySize(cap);
mKeys = new int[cap];
mValues = new int[cap];
mSize = 0;
} catch (OutOfMemoryError err) {
System.err.println("requested capacity " + cap);
throw err;
}
}
代码示例来源:origin: com.rgi-corp/graphhopper
/**
* Creates a new SparseIntIntArray containing no mappings that will not require any additional
* memory allocation to store the specified number of mappings.
*/
public SparseIntIntArray(int cap) {
try {
cap = Helper.idealIntArraySize(cap);
mKeys = new int[cap];
mValues = new int[cap];
mSize = 0;
} catch (OutOfMemoryError err) {
System.err.println("requested capacity " + cap);
throw err;
}
}
代码示例来源:origin: com.graphhopper/graphhopper
/**
* Creates a new SparseIntIntArray containing no mappings that will not require any additional
* memory allocation to store the specified number of mappings.
*/
public SparseIntIntArray( int cap )
{
try
{
cap = Helper.idealIntArraySize(cap);
mKeys = new int[cap];
mValues = new int[cap];
mSize = 0;
} catch (OutOfMemoryError err)
{
System.err.println("requested capacity " + cap);
throw err;
}
}
代码示例来源:origin: com.graphhopper/graphhopper-core
/**
* Puts a key/value pair into the array, optimizing for the case where the key is greater than
* all existing keys in the array.
*/
public int append(int key, int value) {
if (mSize != 0 && key <= mKeys[mSize - 1]) {
return put(key, value);
}
if (mGarbage && mSize >= mKeys.length) {
gc();
}
int pos = mSize;
if (pos >= mKeys.length) {
int n = Helper.idealIntArraySize(pos + 1);
int[] nkeys = new int[n];
int[] nvalues = new int[n];
System.arraycopy(mKeys, 0, nkeys, 0, mKeys.length);
System.arraycopy(mValues, 0, nvalues, 0, mValues.length);
mKeys = nkeys;
mValues = nvalues;
}
mKeys[pos] = key;
mValues[pos] = value;
mSize = pos + 1;
return pos;
}
代码示例来源:origin: com.rgi-corp/graphhopper
/**
* Puts a key/value pair into the array, optimizing for the case where the key is greater than
* all existing keys in the array.
*/
public int append(int key, int value) {
if (mSize != 0 && key <= mKeys[mSize - 1]) {
return put(key, value);
}
if (mGarbage && mSize >= mKeys.length) {
gc();
}
int pos = mSize;
if (pos >= mKeys.length) {
int n = Helper.idealIntArraySize(pos + 1);
int[] nkeys = new int[n];
int[] nvalues = new int[n];
System.arraycopy(mKeys, 0, nkeys, 0, mKeys.length);
System.arraycopy(mValues, 0, nvalues, 0, mValues.length);
mKeys = nkeys;
mValues = nvalues;
}
mKeys[pos] = key;
mValues[pos] = value;
mSize = pos + 1;
return pos;
}
代码示例来源:origin: com.graphhopper/graphhopper
/**
* Puts a key/value pair into the array, optimizing for the case where the key is greater than
* all existing keys in the array.
*/
public int append( int key, int value )
{
if (mSize != 0 && key <= mKeys[mSize - 1])
{
return put(key, value);
}
if (mGarbage && mSize >= mKeys.length)
{
gc();
}
int pos = mSize;
if (pos >= mKeys.length)
{
int n = Helper.idealIntArraySize(pos + 1);
int[] nkeys = new int[n];
int[] nvalues = new int[n];
System.arraycopy(mKeys, 0, nkeys, 0, mKeys.length);
System.arraycopy(mValues, 0, nvalues, 0, mValues.length);
mKeys = nkeys;
mValues = nvalues;
}
mKeys[pos] = key;
mValues[pos] = value;
mSize = pos + 1;
return pos;
}
代码示例来源:origin: com.graphhopper/graphhopper
int n = Helper.idealIntArraySize(mSize + 1);
代码示例来源:origin: com.graphhopper/graphhopper-core
int n = Helper.idealIntArraySize(mSize + 1);
代码示例来源:origin: com.rgi-corp/graphhopper
int n = Helper.idealIntArraySize(mSize + 1);
内容来源于网络,如有侵权,请联系作者删除!