本文整理汇总了Java中it.unimi.dsi.fastutil.ints.Int2ObjectMap.Entry方法的典型用法代码示例。如果您正苦于以下问题:Java Int2ObjectMap.Entry方法的具体用法?Java Int2ObjectMap.Entry怎么用?Java Int2ObjectMap.Entry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类it.unimi.dsi.fastutil.ints.Int2ObjectMap
的用法示例。
在下文中一共展示了Int2ObjectMap.Entry方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: adjustClocks
import it.unimi.dsi.fastutil.ints.Int2ObjectMap; //导入方法依赖的package包/类
/**
* Adjust clock values
* @param taskToMatrixClocks taskId->(matrixId->clock) map
*/
public void adjustClocks(Int2ObjectOpenHashMap<Int2IntOpenHashMap> taskToMatrixClocks) {
ObjectIterator<Int2ObjectMap.Entry<Int2IntOpenHashMap>> taskIter =
taskToMatrixClocks.int2ObjectEntrySet().fastIterator();
Int2ObjectMap.Entry<Int2IntOpenHashMap> taskEntry = null;
int taskId = 0;
Int2IntOpenHashMap matrixIdToClockMap = null;
ObjectIterator<Int2IntMap.Entry> matrixIter = null;
Int2IntMap.Entry matrixEntry = null;
while(taskIter.hasNext()) {
taskEntry = taskIter.next();
taskId = taskEntry.getIntKey();
matrixIdToClockMap = taskEntry.getValue();
matrixIter = matrixIdToClockMap.int2IntEntrySet().fastIterator();
while (matrixIter.hasNext()) {
matrixEntry = matrixIter.next();
updateClock(matrixEntry.getIntKey(), taskId, matrixEntry.getIntValue());
}
}
}
示例2: pairToEntry
import it.unimi.dsi.fastutil.ints.Int2ObjectMap; //导入方法依赖的package包/类
public static Int2ObjectMap.Entry pairToEntry(final IntObjectPair pair) {
return new Int2ObjectMap.Entry() {
@Override
public int getIntKey() {
return pair.getFirstInt();
}
@Override
public Object getKey() {
return pair.getFirst();
}
@Override
public Object getValue() {
return pair.getSecond();
}
@Override
public Object setValue(Object value) {
throw new UnsupportedOperationException("This entry is immutable");
}
};
}
示例3: getWeightedRandomReversed
import it.unimi.dsi.fastutil.ints.Int2ObjectMap; //导入方法依赖的package包/类
@Nullable
public static <T> T getWeightedRandomReversed(Random random, Int2ObjectMap<T> choices)
{
long i = 0;
IntSet ints = choices.keySet();
for (IntIterator iterator = ints.iterator(); iterator.hasNext(); )
{
int x = iterator.nextInt();
i += x;
}
i = getRandomLong(random, 0, i);
for (Int2ObjectMap.Entry<T> entry : choices.int2ObjectEntrySet())
{
i -= entry.getIntKey();
if (i < 0)
{
return entry.getValue();
}
}
return null;
}
示例4: get
import it.unimi.dsi.fastutil.ints.Int2ObjectMap; //导入方法依赖的package包/类
public Vector get(int index) {
int count = 0;
ObjectIterator<Int2ObjectMap.Entry<LocalBlockVectorSet>> iter = localSets.int2ObjectEntrySet().iterator();
while (iter.hasNext()) {
Int2ObjectMap.Entry<LocalBlockVectorSet> entry = iter.next();
LocalBlockVectorSet set = entry.getValue();
int size = set.size();
int newSize = count + size;
if (newSize > index) {
int localIndex = index - count;
Vector pos = set.getIndex(localIndex);
if (pos != null) {
int pair = entry.getIntKey();
int cx = MathMan.unpairX(pair);
int cz = MathMan.unpairY(pair);
pos.mutX((cx << 11) + pos.getBlockX());
pos.mutZ((cz << 11) + pos.getBlockZ());
return pos;
}
}
count += newSize;
}
return null;
}
示例5: calculateLayerArrays
import it.unimi.dsi.fastutil.ints.Int2ObjectMap; //导入方法依赖的package包/类
protected void calculateLayerArrays() {
Int2ObjectOpenHashMap<char[]> colorLayerMap = new Int2ObjectOpenHashMap<>();
for (int i = 0; i < validBlockIds.length; i++) {
int color = validColors[i];
int combined = validBlockIds[i];
if (hasAlpha(color)) {
for (int j = 0; j < validBlockIds.length; j++) {
int colorOther = validColors[j];
if (!hasAlpha(colorOther)) {
int combinedOther = validBlockIds[j];
int combinedColor = combineTransparency(color, colorOther);
colorLayerMap.put(combinedColor, new char[]{(char) combined, (char) combinedOther});
}
}
}
}
this.validLayerColors = new int[colorLayerMap.size()];
this.validLayerBlocks = new char[colorLayerMap.size()][];
int index = 0;
for (Int2ObjectMap.Entry<char[]> entry : colorLayerMap.int2ObjectEntrySet()) {
validLayerColors[index] = entry.getIntKey();
validLayerBlocks[index++] = entry.getValue();
}
}
示例6: saveCanonicalIds
import it.unimi.dsi.fastutil.ints.Int2ObjectMap; //导入方法依赖的package包/类
private void saveCanonicalIds() {
Int2ObjectOpenHashMap mappings = canonicalIdHolder.getAllMappings();
for (ObjectIterator<Int2ObjectMap.Entry<?>> i = mappings.int2ObjectEntrySet().fastIterator(); i
.hasNext();) {
Int2ObjectMap.Entry<?> entry = i.next();
writeCanonicalId(entry.getIntKey(), entry.getValue());
}
}
示例7: buildMatrix
import it.unimi.dsi.fastutil.ints.Int2ObjectMap; //导入方法依赖的package包/类
@Override
public ColumnMajorDenseMatrix2d buildMatrix() {
final double[][] data = new double[maxNumColumns][];
for (Int2ObjectMap.Entry<SparseDoubleArray> e : Fastutil.fastIterable(col2rows)) {
int col = e.getIntKey();
SparseDoubleArray rows = e.getValue();
data[col] = rows.toArray();
}
return new ColumnMajorDenseMatrix2d(data, row, nnz);
}
示例8: fastIterable
import it.unimi.dsi.fastutil.ints.Int2ObjectMap; //导入方法依赖的package包/类
@Nonnull
public static <V> ObjectIterable<Int2ObjectMap.Entry<V>> fastIterable(
@Nonnull final Int2ObjectMap<V> map) {
final ObjectSet<Int2ObjectMap.Entry<V>> entries = map.int2ObjectEntrySet();
return entries instanceof Int2ObjectMap.FastEntrySet ? new ObjectIterable<Int2ObjectMap.Entry<V>>() {
public ObjectIterator<Int2ObjectMap.Entry<V>> iterator() {
return ((Int2ObjectMap.FastEntrySet<V>) entries).fastIterator();
}
}
: entries;
}
示例9: DictionaryMap
import it.unimi.dsi.fastutil.ints.Int2ObjectMap; //导入方法依赖的package包/类
/**
* Returns a new DictionaryMap that is a deep copy of the original
*/
public DictionaryMap(DictionaryMap original) {
for (Int2ObjectMap.Entry<String> entry : original.keyToValue.int2ObjectEntrySet()) {
keyToValue.put(entry.getIntKey(), entry.getValue());
valueToKey.put(entry.getValue(), entry.getIntKey());
}
valueToKey.defaultReturnValue(-1);
}
示例10: serialize
import it.unimi.dsi.fastutil.ints.Int2ObjectMap; //导入方法依赖的package包/类
public static List<DataView> serialize(InventorySnapshot inventorySnapshot) {
final ObjectSerializer<LanternItemStack> itemStackSerializer = ObjectSerializerRegistry.get().get(LanternItemStack.class).get();
final List<DataView> itemViews = new ArrayList<>();
for (Int2ObjectMap.Entry<ItemStackSnapshot> entry : inventorySnapshot.getItemStackSnapshots().int2ObjectEntrySet()) {
final DataView itemView = itemStackSerializer.serialize((LanternItemStack) entry.getValue().createStack());
//noinspection ConstantConditions
itemView.set(SLOT, (byte) entry.getIntKey());
itemViews.add(itemView);
}
return itemViews;
}
示例11: toString
import it.unimi.dsi.fastutil.ints.Int2ObjectMap; //导入方法依赖的package包/类
/**
* Converts the integer value into a {@link RomanNumber}.
*
* @param value The integer value
* @return The roman number
* @throws IllegalRomanNumberException If the specified is negative, zero or greater then 3999
*/
public static String toString(int value) throws IllegalRomanNumberException {
checkIllegalNumber(value);
final StringBuilder builder = new StringBuilder();
for (Int2ObjectMap.Entry<String> entry : VALUES_TO_STRING.int2ObjectEntrySet()) {
final long count = value / entry.getIntKey();
for (long i = 0; i < count; i++) {
builder.append(entry.getValue());
}
value = value % entry.getIntKey();
}
return builder.toString();
}
示例12: isEmpty
import it.unimi.dsi.fastutil.ints.Int2ObjectMap; //导入方法依赖的package包/类
@Override
public boolean isEmpty() {
for (Int2ObjectMap.Entry<LocalBlockVectorSet> entry : localSets.int2ObjectEntrySet()) {
if (!entry.getValue().isEmpty()) {
return false;
}
}
return true;
}
示例13: iterator
import it.unimi.dsi.fastutil.ints.Int2ObjectMap; //导入方法依赖的package包/类
@Override
public Iterator<Vector> iterator() {
final ObjectIterator<Int2ObjectMap.Entry<LocalBlockVectorSet>> entries = localSets.int2ObjectEntrySet().iterator();
if (!entries.hasNext()) {
return new ArrayList<Vector>().iterator();
}
return new Iterator<Vector>() {
Int2ObjectMap.Entry<LocalBlockVectorSet> entry = entries.next();
Iterator<Vector> entryIter = entry.getValue().iterator();
MutableBlockVector mutable = new MutableBlockVector();
@Override
public void remove() {
entryIter.remove();
}
@Override
public boolean hasNext() {
return entryIter.hasNext() || entries.hasNext();
}
@Override
public Vector next() {
while (!entryIter.hasNext()) {
if (!entries.hasNext()) {
throw new NoSuchElementException("End of iterator");
}
entry = entries.next();
entryIter = entry.getValue().iterator();
}
Vector localPos = entryIter.next();
int pair = entry.getIntKey();
int cx = MathMan.unpairX(pair);
int cz = MathMan.unpairY(pair);
return mutable.setComponents((cx << 11) + localPos.getBlockX(), localPos.getBlockY(), (cz << 11) + localPos.getBlockZ());
}
};
}
示例14: isModified
import it.unimi.dsi.fastutil.ints.Int2ObjectMap; //导入方法依赖的package包/类
public boolean isModified() {
if (isDeleted()) {
return true;
}
synchronized (chunks) {
for (Int2ObjectMap.Entry<MCAChunk> entry : chunks.int2ObjectEntrySet()) {
MCAChunk chunk = entry.getValue();
if (chunk.isModified() || chunk.isDeleted()) {
return true;
}
}
}
return false;
}
示例15: writePartition
import it.unimi.dsi.fastutil.ints.Int2ObjectMap; //导入方法依赖的package包/类
@Override
public void writePartition(DataOutput out,
int partitionId) throws IOException {
Int2ObjectOpenHashMap<DataInputOutput> partitionMap =
map.get(partitionId);
out.writeInt(partitionMap.size());
ObjectIterator<Int2ObjectMap.Entry<DataInputOutput>> iterator =
partitionMap.int2ObjectEntrySet().fastIterator();
while (iterator.hasNext()) {
Int2ObjectMap.Entry<DataInputOutput> entry = iterator.next();
out.writeInt(entry.getIntKey());
entry.getValue().write(out);
}
}