本文整理了Java中gnu.trove.list.TIntList
类的一些代码示例,展示了TIntList
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TIntList
类的具体详情如下:
包路径:gnu.trove.list.TIntList
类名称:TIntList
[英]Interface for Trove list implementations.
[中]Trove列表实现的接口。
代码示例来源:origin: opentripplanner/OpenTripPlanner
int count = 0;
TIntList timeList = new TIntArrayList();
timeList.add(times[i][stop]);
.get(randomNumbers[nextRandom++ % randomNumbers.length] % count);
break;
case PERCENTILE:
timeList.sort();
mins[stop] = timeList.get(timeList.size() / 40);
maxs[stop] = timeList.get(39 * timeList.size() / 40);
break;
case NONE:
case MIN_MAX:
default:
mins[stop] = timeList.min();
maxs[stop] = timeList.max();
break;
代码示例来源:origin: CalebFenton/simplify
public static <T> void shiftIntegerMapKeys(int startKey, int shift, TIntObjectMap<T> intToObject) {
if (shift == 0) {
return;
}
TIntList keysToShift = new TIntArrayList(intToObject.keys());
// Exclude anything before and including startKey
for (int currentKey : keysToShift.toArray()) {
if (currentKey <= startKey) {
keysToShift.remove(currentKey);
}
}
keysToShift.sort();
if (shift > 0) {
// Shifting keys up, so start at the end to avoid overwriting keys.
keysToShift.reverse();
}
for (int currentKey : keysToShift.toArray()) {
T obj = intToObject.get(currentKey);
intToObject.remove(currentKey);
intToObject.put(currentKey + shift, obj);
}
}
}
代码示例来源:origin: alibaba/mdrill
public TIntLinkedList(TIntList list) {
no_entry_value = list.getNoEntryValue();
//
for (TIntIterator iterator = list.iterator(); iterator.hasNext();) {
int next = iterator.next();
add(next);
}
}
代码示例来源:origin: MovingBlocks/Terasology
public void setVertexWeights(TIntList vertexStartWeight, TIntList vertexWeightCount) {
this.vertexStartWeights.clear();
this.vertexStartWeights.addAll(vertexStartWeight);
this.vertexWeightCounts.clear();
this.vertexWeightCounts.addAll(vertexWeightCount);
}
代码示例来源:origin: MovingBlocks/Terasology
private void iterate() {
while (i < positionList.size() - 2) {
nextResult.x = positionList.get(i++);
nextResult.y = positionList.get(i++);
nextResult.z = positionList.get(i++);
if (!registry.hasPermanentBlockEntity(nextResult)) {
return;
}
}
nextResult = null;
}
代码示例来源:origin: alibaba/mdrill
@Override
public Integer get( int index ) {
int value = list.get( index );
if ( value == list.getNoEntryValue() ) return null;
else return Integer.valueOf( value );
}
代码示例来源:origin: MovingBlocks/Terasology
@Override
public TIntList getAsIntegerArray() {
TIntList result = new TIntArrayList(size());
for (JsonElement element : array) {
result.add(element.getAsInt());
}
return result;
}
代码示例来源:origin: CalebFenton/simplify
TIntList removeIndexes = new TIntArrayList();
while (iter.hasNext()) {
int index = iter.nextIndex();
removeIndexes.add(index);
removeIndexes.sort();
removeIndexes.reverse();
for (int index : removeIndexes.toArray()) {
tryBlocks.remove(index);
代码示例来源:origin: opentripplanner/OpenTripPlanner
stopIndex = indexForStop.size();
indexForStop.put(vidx, stopIndex);
stopForIndex.add(vidx);
stopNames.add(stop.getName());
stopIndexesForPattern.add(stopIndex);
timetable.stopIndices = stopIndexesForPattern.toArray();
int stopIndex = stopForIndex.size();
addedStops.put(t, stopIndex);
indexForStop.put(t.index, stopIndex);
stopForIndex.add(t.index);
transfersFromStopWithGraphIndices.put(stopForIndex.get(trIt.key()), trIt.value());
int graphIndex = stopForIndex.get(it.key());
patternsForStopList.get(stop).add(pattern);
patternsForStop.add(patternsForStopList.get(stop).toArray());
for (TIntIterator it = stopForIndex.iterator(); it.hasNext();) {
int targetStopIndex = indexForStop.get(simpleTransfer.getToVertex().getIndex());
if (targetStopIndex != -1) {
transfers.add(targetStopIndex);
transfers.add((int) (simpleTransfer.getDistance()));
代码示例来源:origin: MovingBlocks/Terasology
TIntList results = new TIntArrayList(contents.size());
if (contents.size() > 0) {
int width = canvas.size().x - horizontalSpacing * (contents.size() - 1);
if (!hint.isUseContentWidth() && hint.getRelativeWidth() != 0) {
int elementWidth = TeraMath.floorToInt(hint.getRelativeWidth() * width);
results.add(elementWidth);
totalWidthUsed += elementWidth;
} else {
results.add(0);
unprocessedWidgets++;
results.add(0);
unprocessedWidgets++;
for (int i = 0; i < results.size(); ++i) {
if (results.get(i) == 0) {
RowLayoutHint hint = hints.get(contents.get(i));
if (hint != null) {
if (hint.isUseContentWidth()) {
Vector2i contentSize = contents.get(i).getPreferredContentSize(canvas, new Vector2i(remainingWidthPerElement, canvas.size().y));
results.set(i, contentSize.x);
totalWidthUsed += contentSize.x;
unprocessedWidgets--;
for (int i = 0; i < results.size(); ++i) {
if (results.get(i) == 0) {
results.set(i, remainingWidthPerElement);
代码示例来源:origin: opentripplanner/OpenTripPlanner
/**
* Add a variable number of int arguments or an array of ints to the bag for a given stopcluster.
* Optionally sort all the entries after a bulk add.
*/
public void add(StopCluster stopCluster, boolean sort, int... time) {
TIntList times = timesForCluster.get(stopCluster);
if (times == null) {
times = new TIntArrayList();
timesForCluster.put(stopCluster, times);
}
times.add(time);
if (sort) {
times.sort();
}
}
代码示例来源:origin: MovingBlocks/Terasology
TIntList indices = new TIntArrayList();
for (int[] face : faces) {
for (int tri = 0; tri < face.length - 2; tri++) {
indices.add(face[0]);
indices.add(face[tri + 1]);
indices.add(face[tri + 2]);
indices.forEach(value -> {
if (value < 0 || value >= vertices.length) {
throw new JsonParseException("Face value out of range: " + value + ", max vertex is " + (vertices.length - 1));
});
return new BlockMeshPart(vertices, normals, texCoords, indices.toArray());
代码示例来源:origin: MovingBlocks/Terasology
TIntList partSizes = new TIntArrayList();
int vertexCount = newData.getVertices().size() / VERTEX_SIZE;
int vertexSize = VERTEX_SIZE;
parts.add(newData.getVertices().iterator());
partSizes.add(VERTEX_SIZE);
partSizes.add(TEX_COORD_0_SIZE);
texCoord0Offset = vertexSize * FLOAT_SIZE;
vertexSize += TEX_COORD_0_SIZE;
partSizes.add(TEX_COORD_1_SIZE);
texCoord1Offset = vertexSize * FLOAT_SIZE;
vertexSize += TEX_COORD_1_SIZE;
partSizes.add(NORMAL_SIZE);
normalOffset = vertexSize * FLOAT_SIZE;
vertexSize += NORMAL_SIZE;
partSizes.add(COLOR_SIZE);
colorOffset = vertexSize * FLOAT_SIZE;
vertexSize += COLOR_SIZE;
indexCount = newData.getIndices().size();
代码示例来源:origin: searchhub/preDict
private void addLowestDistance(DictionaryItem item, String word, int wordNr, String fragment) {
int indexedDistance = item.suggestions.size() > 0
? wordlist.get(item.suggestions.get(0)).length() - fragment.length()
: -1;
int fragmentDistance = word.length() - fragment.length();
// remove all existing suggestions (of higher distance) if this word has
// a lower distance (only at recallLevel < 2)
if ((accuracyLevel.ordinal() < 2) && (indexedDistance > fragmentDistance)) {
item.suggestions.clear();
}
// if recall level is 2, add this word anyways
// otherwise only add it if it has a similar or lower distance
// then the indexed words
if ((accuracyLevel.ordinal() == 2)
|| (item.suggestions.size() == 0)
|| (indexedDistance >= fragmentDistance)) {
item.suggestions.add(wordNr);
}
}
代码示例来源:origin: MovingBlocks/Terasology
/**
* @param boneNames The names of the bones this animation expects
* @param boneParents The indices of the parent of each bone in the boneNames list, NO_PARENT for no parent.
* @param aabb A bounding box that contains the object in all animation stops.
* @param frames
* @param timePerFrame
*/
public MeshAnimationData(List<String> boneNames, TIntList boneParents, List<MeshAnimationFrame> frames,
float timePerFrame, AABB aabb) {
if (boneNames.size() != boneParents.size()) {
throw new IllegalArgumentException("Bone names and boneParent indices must align");
}
this.boneNames = ImmutableList.copyOf(boneNames);
this.boneParent = new TIntArrayList(boneParents);
this.frames = ImmutableList.copyOf(frames);
this.timePerFrame = timePerFrame;
this.aabb = aabb;
}
代码示例来源:origin: CalebFenton/simplify
private int[] buildParameterRegisters(List<String> parameterTypes, int[] registers) {
TIntList parameterRegisters = new TIntLinkedList(parameterTypes.size());
int index = 0;
for (String parameterType : parameterTypes) {
parameterRegisters.add(registers[index]);
index += Utils.getRegisterSize(parameterType);
}
return parameterRegisters.toArray();
}
代码示例来源:origin: MovingBlocks/Terasology
public void add(int amount) {
modifiers.add(amount);
}
代码示例来源:origin: com.graphhopper/graphhopper
public static Graph shuffle( Graph g, Graph sortedGraph )
{
int len = g.getNodes();
TIntList list = new TIntArrayList(len, -1);
list.fill(0, len, -1);
for (int i = 0; i < len; i++)
{
list.set(i, i);
}
list.shuffle(new Random());
return createSortedGraph(g, sortedGraph, list);
}
代码示例来源:origin: MovingBlocks/Terasology
public int get(String forUseBy) {
if (pool.isEmpty()) {
IntBuffer buffer = BufferUtils.createIntBuffer(BUFFER_FETCH_SIZE);
GL15.glGenBuffers(buffer);
for (int i = 0; i < BUFFER_FETCH_SIZE; ++i) {
pool.add(buffer.get(i));
}
totalPoolSize += BUFFER_FETCH_SIZE;
}
int result = pool.removeAt(pool.size() - 1);
if (traceBufferUsage) {
usageTracker.put(result, forUseBy);
}
return result;
}
代码示例来源:origin: alibaba/mdrill
/**
* Expands the set to accommodate new values.
*
* @param newCapacity an <code>int</code> value
*/
@Override
protected void rehash(int newCapacity) {
TIntLinkedList oldOrder = new TIntLinkedList(order);
int oldSize = size();
Object oldSet[] = _set;
order.clear();
_set = new Object[newCapacity];
Arrays.fill(_set, FREE);
for (TIntIterator iterator = oldOrder.iterator(); iterator.hasNext();) {
int i = iterator.next();
E o = (E) oldSet[i];
if (o == FREE || o == REMOVED) {
throw new IllegalStateException("Iterating over empty location while rehashing");
}
if (o != FREE && o != REMOVED) {
int index = insertKey(o);
if (index < 0) { // everyone pays for this because some people can't RTFM
throwObjectContractViolation(_set[(-index - 1)], o, size(), oldSize, oldSet);
}
if (!order.add(index))
throw new IllegalStateException("Order not changed after insert");
}
}
}
内容来源于网络,如有侵权,请联系作者删除!