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


Java Int2ObjectOpenHashMap类代码示例

本文整理汇总了Java中it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap的典型用法代码示例。如果您正苦于以下问题:Java Int2ObjectOpenHashMap类的具体用法?Java Int2ObjectOpenHashMap怎么用?Java Int2ObjectOpenHashMap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Int2ObjectOpenHashMap类属于it.unimi.dsi.fastutil.ints包,在下文中一共展示了Int2ObjectOpenHashMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getTaskMatrixClocks

import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; //导入依赖的package包/类
/**
 * Get task clocks for all matrices from Master
 * @return task clocks for all matrices from Master
 * @throws ServiceException
 */
public Int2ObjectOpenHashMap<Int2IntOpenHashMap> getTaskMatrixClocks() throws ServiceException {
  GetTaskMatrixClockResponse response = masterProxy.getTaskMatrixClocks(null,
    GetTaskMatrixClockRequest.newBuilder().build());
  Int2ObjectOpenHashMap<Int2IntOpenHashMap> taskIdToMatrixClocksMap = new Int2ObjectOpenHashMap<>(response.getTaskMatrixClocksCount());

  List<TaskMatrixClock> taskMatrixClocks = response.getTaskMatrixClocksList();
  int size = taskMatrixClocks.size();
  int matrixNum;
  for(int i = 0; i < size; i++) {
    Int2IntOpenHashMap matrixIdToClockMap = new Int2IntOpenHashMap(taskMatrixClocks.get(i).getMatrixClocksCount());
    taskIdToMatrixClocksMap.put(taskMatrixClocks.get(i).getTaskId().getTaskIndex(), matrixIdToClockMap);
    List<MatrixClock> matrixClocks = taskMatrixClocks.get(i).getMatrixClocksList();
    matrixNum = matrixClocks.size();
    for(int j = 0; j < matrixNum; j++) {
      matrixIdToClockMap.put(matrixClocks.get(j).getMatrixId(), matrixClocks.get(j).getClock());
    }
  }

  return taskIdToMatrixClocksMap;
}
 
开发者ID:Tencent,项目名称:angel,代码行数:26,代码来源:MasterClient.java

示例2: adjustClocks

import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; //导入依赖的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());
    }
  }
}
 
开发者ID:Tencent,项目名称:angel,代码行数:25,代码来源:ClockVectorManager.java

示例3: initializeAttributes

import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; //导入依赖的package包/类
protected void initializeAttributes() throws AlgorithmExecutionException {
	this.numColumns = this.columnNames.size();
	
	this.attributeId2attributeObject = new Int2ObjectOpenHashMap<Attribute>(this.numColumns);
	this.attributeObjectQueue = new PriorityQueue<Attribute>(this.numColumns);
	
	for (int table = 0; table < this.tableNames.length; table++) {
		int firstAttribute = this.tableColumnStartIndexes[table];
		int lastAttribute = (table == this.tableNames.length - 1) ? this.numColumns : this.tableColumnStartIndexes[table + 1];
		
		for (int attribute = firstAttribute; attribute < lastAttribute; attribute++) {
			Attribute spiderAttribute;
			if (this.databaseConnectionGenerator != null)
				spiderAttribute = new Attribute(attribute, this.columnTypes, this.databaseConnectionGenerator, this.inputRowLimit, this.dao, this.tableNames[table], this.columnNames.get(attribute), this.tempFolder);
			else
				spiderAttribute = new Attribute(attribute, this.columnTypes, this.fileInputGenerator[table], this.inputRowLimit, attribute - firstAttribute, this.tempFolder, this.maxMemoryUsage, this.memoryCheckFrequency);
			this.attributeId2attributeObject.put(attribute, spiderAttribute);
			
			if (!spiderAttribute.hasFinished())
				this.attributeObjectQueue.add(spiderAttribute);
		}
	}
}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:24,代码来源:SPIDER.java

示例4: output

import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; //导入依赖的package包/类
private void output() throws CouldNotReceiveResultException, ColumnNameMismatchException {
	// Read the discovered INDs from the attributes
	Int2ObjectOpenHashMap<IntList> dep2ref = new Int2ObjectOpenHashMap<IntList>(this.numColumns);
	for (Attribute spiderAttribute : this.attributeId2attributeObject.values())
		if (!spiderAttribute.getReferenced().isEmpty())
			dep2ref.put(spiderAttribute.getAttributeId(), new IntArrayList(spiderAttribute.getReferenced()));
	
	// Write the result to the resultReceiver
	for (int dep : dep2ref.keySet()) {
		String depTableName = this.getTableNameFor(dep, this.tableColumnStartIndexes);
		String depColumnName = this.columnNames.get(dep);
		
		for (int ref : dep2ref.get(dep)) {
			String refTableName = this.getTableNameFor(ref, this.tableColumnStartIndexes);
			String refColumnName = this.columnNames.get(ref);
			
			this.resultReceiver.receiveResult(new InclusionDependency(new ColumnPermutation(new ColumnIdentifier(depTableName, depColumnName)), new ColumnPermutation(new ColumnIdentifier(refTableName, refColumnName))));
			this.numUnaryINDs++;
		}
	}
}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:22,代码来源:SPIDER.java

示例5: generalize

import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; //导入依赖的package包/类
public void generalize() {
	int maxLevel = this.numAttributes;
	
	// Build an index level->nodes for the top-down, level-wise traversal
	Int2ObjectOpenHashMap<ArrayList<ElementLhsPair>> level2elements = new Int2ObjectOpenHashMap<>(maxLevel);
	for (int level = 0; level < maxLevel; level++)
		level2elements.put(level, new ArrayList<ElementLhsPair>());
	this.addToIndex(level2elements, 0, new OpenBitSet(this.numAttributes));
	
	// Traverse the levels top-down and add all direct generalizations
	for (int level = maxLevel - 1; level >= 0; level--) {
		for (ElementLhsPair pair : level2elements.get(level)) {
			// Remove isFDs, because we will mark valid FDs later on
			pair.element.removeAllFds();
			
			// Generate and add generalizations
			for (int lhsAttr = pair.lhs.nextSetBit(0); lhsAttr >= 0; lhsAttr = pair.lhs.nextSetBit(lhsAttr + 1)) {
				pair.lhs.clear(lhsAttr);
				FDTreeElement generalization = this.addGeneralization(pair.lhs, pair.element.getRhsAttributes());
				if (generalization != null)
					level2elements.get(level - 1).add(new ElementLhsPair(generalization, pair.lhs.clone()));
				pair.lhs.set(lhsAttr);
			}
		}
	}
}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:27,代码来源:FDTree.java

示例6: init

import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; //导入依赖的package包/类
protected static Entry<Map<String, SimpleEnum<?>>, Int2ObjectMap<SimpleEnum<?>>> init(final Class<?> clazz, final int size)
{
    Map<String, SimpleEnum<?>> byName = ASimpleEnum.byName.get(clazz);
    if (byName == null)
    {
        byName = new CaseInsensitiveMap<>(size, SMALL_LOAD_FACTOR);
        ASimpleEnum.byName.put(clazz, byName);
    }
    Int2ObjectMap<SimpleEnum<?>> byID = ASimpleEnum.byOrdinal.get(clazz);
    if (byID == null)
    {
        byID = new Int2ObjectOpenHashMap<>(size, SMALL_LOAD_FACTOR);
        ASimpleEnum.byOrdinal.put(clazz, byID);
    }
    return new SimpleEntry<>(byName, byID);
}
 
开发者ID:Diorite,项目名称:Diorite-old,代码行数:17,代码来源:SimpleEnum.java

示例7: replayTrain

import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; //导入依赖的package包/类
private void replayTrain(@Nonnull final ByteBuffer buf) {
    final int itemI = buf.getInt();
    final int knnSize = buf.getInt();

    final Int2ObjectMap<Int2FloatMap> knnItems = new Int2ObjectOpenHashMap<>(1024);
    final IntSet pairItems = new IntOpenHashSet();
    for (int i = 0; i < knnSize; i++) {
        int user = buf.getInt();
        int ruSize = buf.getInt();
        Int2FloatMap ru = new Int2FloatOpenHashMap(ruSize);
        ru.defaultReturnValue(0.f);

        for (int j = 0; j < ruSize; j++) {
            int itemK = buf.getInt();
            pairItems.add(itemK);
            float ruk = buf.getFloat();
            ru.put(itemK, ruk);
        }
        knnItems.put(user, ru);
    }

    for (int itemJ : pairItems) {
        train(itemI, knnItems, itemJ);
    }
}
 
开发者ID:apache,项目名称:incubator-hivemall,代码行数:26,代码来源:SlimUDTF.java

示例8: kNNentries

import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; //导入依赖的package包/类
@Nonnull
private static Int2ObjectMap<Int2FloatMap> kNNentries(@Nonnull final Object kNNiObj,
        @Nonnull final MapObjectInspector knnItemsOI,
        @Nonnull final PrimitiveObjectInspector knnItemsKeyOI,
        @Nonnull final MapObjectInspector knnItemsValueOI,
        @Nonnull final PrimitiveObjectInspector knnItemsValueKeyOI,
        @Nonnull final PrimitiveObjectInspector knnItemsValueValueOI,
        @Nullable Int2ObjectMap<Int2FloatMap> knnItems, @Nonnull final MutableInt nnzKNNi) {
    if (knnItems == null) {
        knnItems = new Int2ObjectOpenHashMap<>(1024);
    } else {
        knnItems.clear();
    }

    int numElementOfKNNItems = 0;
    for (Map.Entry<?, ?> entry : knnItemsOI.getMap(kNNiObj).entrySet()) {
        int user = PrimitiveObjectInspectorUtils.getInt(entry.getKey(), knnItemsKeyOI);
        Int2FloatMap ru = int2floatMap(knnItemsValueOI.getMap(entry.getValue()),
            knnItemsValueKeyOI, knnItemsValueValueOI);
        knnItems.put(user, ru);
        numElementOfKNNItems += ru.size();
    }

    nnzKNNi.setValue(numElementOfKNNItems);
    return knnItems;
}
 
开发者ID:apache,项目名称:incubator-hivemall,代码行数:27,代码来源:SlimUDTF.java

示例9: calculateLayerArrays

import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; //导入依赖的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();
    }
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:25,代码来源:TextureUtil.java

示例10: getCandidates

import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; //导入依赖的package包/类
/**
 * Get the candidates: points which have at least one hash bucket in common.
 * 
 * @param obj Query object
 * @return Candidates
 */
protected DBIDs getCandidates(V obj) {
  ModifiableDBIDs candidates = null;
  final int numhash = hashtables.size();
  double[] buf = new double[hashfunctions.get(0).getNumberOfProjections()];
  for(int i = 0; i < numhash; i++) {
    final Int2ObjectOpenHashMap<DBIDs> table = hashtables.get(i);
    final LocalitySensitiveHashFunction<? super V> hashfunc = hashfunctions.get(i);
    // Get the initial (unbounded) hash code:
    int hash = hashfunc.hashObject(obj, buf);
    // Reduce to hash table size
    int bucket = hash % numberOfBuckets;
    DBIDs cur = table.get(bucket);
    if(cur != null) {
      if(candidates == null) {
        candidates = DBIDUtil.newHashSet(cur.size() * numhash);
      }
      candidates.addDBIDs(cur);
    }
  }
  return (candidates == null) ? DBIDUtil.EMPTYDBIDS : candidates;
}
 
开发者ID:elki-project,项目名称:elki,代码行数:28,代码来源:InMemoryLSHIndex.java

示例11: run

import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; //导入依赖的package包/类
/**
 * Run the algorithm on a database.
 * 
 * @param db Database
 * @param relation Relation to process.
 * @return Hierarchical result
 */
public PointerPrototypeHierarchyRepresentationResult run(Database db, Relation<O> relation) {
  DistanceQuery<O> dq = DatabaseUtil.precomputedDistanceQuery(db, relation, getDistanceFunction(), LOG);
  final DBIDs ids = relation.getDBIDs();
  final int size = ids.size();

  // Initialize space for result:
  PointerHierarchyRepresentationBuilder builder = new PointerHierarchyRepresentationBuilder(ids, dq.getDistanceFunction().isSquared());
  Int2ObjectOpenHashMap<ModifiableDBIDs> clusters = new Int2ObjectOpenHashMap<>(size);

  // Allocate working space:
  MatrixParadigm mat = new MatrixParadigm(ids);
  ArrayModifiableDBIDs prots = DBIDUtil.newArray(MatrixParadigm.triangleSize(size));
  initializeMatrices(mat, prots, dq);

  DBIDArrayMIter protiter = prots.iter();
  FiniteProgress progress = LOG.isVerbose() ? new FiniteProgress("MiniMax clustering", size - 1, LOG) : null;
  DBIDArrayIter ix = mat.ix;
  for(int i = 1, end = size; i < size; i++) {
    end = AGNES.shrinkActiveSet(ix, builder, end, //
        findMerge(end, mat, protiter, builder, clusters, dq));
    LOG.incrementProcessed(progress);
  }
  LOG.ensureCompleted(progress);
  return (PointerPrototypeHierarchyRepresentationResult) builder.complete();
}
 
开发者ID:elki-project,项目名称:elki,代码行数:33,代码来源:MiniMax.java

示例12: updateMatrices

import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; //导入依赖的package包/类
/**
 * Update the entries of the matrices that contain a distance to c, the newly
 * merged cluster.
 * 
 * @param size number of ids in the data set
 * @param mat matrix paradigm
 * @param prots calculated prototypes
 * @param builder Result builder
 * @param clusters the clusters
 * @param dq distance query of the data set
 * @param c the cluster to update distances to
 */
protected static <O> void updateMatrices(int size, MatrixParadigm mat, DBIDArrayMIter prots, PointerHierarchyRepresentationBuilder builder, Int2ObjectOpenHashMap<ModifiableDBIDs> clusters, DistanceQuery<O> dq, int c) {
  final DBIDArrayIter ix = mat.ix, iy = mat.iy;
  // c is the new cluster.
  // Update entries (at (x,y) with x > y) in the matrix where x = c or y = c

  // Update entries at (c,y) with y < c
  ix.seek(c);
  for(iy.seek(0); iy.getOffset() < c; iy.advance()) {
    // Skip entry if already merged
    if(builder.isLinked(iy)) {
      continue;
    }
    updateEntry(mat, prots, clusters, dq, c, iy.getOffset());
  }

  // Update entries at (x,c) with x > c
  iy.seek(c);
  for(ix.seek(c + 1); ix.valid(); ix.advance()) {
    // Skip entry if already merged
    if(builder.isLinked(ix)) {
      continue;
    }
    updateEntry(mat, prots, clusters, dq, ix.getOffset(), c);
  }
}
 
开发者ID:elki-project,项目名称:elki,代码行数:38,代码来源:MiniMax.java

示例13: run

import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; //导入依赖的package包/类
/**
 * Run the algorithm
 * 
 * @param db Database to run on
 * @param relation Data relation
 * @return Clustering result
 */
public PointerPrototypeHierarchyRepresentationResult run(Database db, Relation<O> relation) {
  DistanceQuery<O> dq = DatabaseUtil.precomputedDistanceQuery(db, relation, getDistanceFunction(), LOG);
  final DBIDs ids = relation.getDBIDs();

  // Initialize space for result:
  PointerHierarchyRepresentationBuilder builder = new PointerHierarchyRepresentationBuilder(ids, dq.getDistanceFunction().isSquared());
  Int2ObjectOpenHashMap<ModifiableDBIDs> clusters = new Int2ObjectOpenHashMap<>(ids.size());

  MatrixParadigm mat = new MatrixParadigm(ids);
  ArrayModifiableDBIDs prots = DBIDUtil.newArray(MatrixParadigm.triangleSize(ids.size()));

  MiniMax.initializeMatrices(mat, prots, dq);

  nnChainCore(mat, prots.iter(), dq, builder, clusters);

  return (PointerPrototypeHierarchyRepresentationResult) builder.complete();
}
 
开发者ID:elki-project,项目名称:elki,代码行数:25,代码来源:MiniMaxNNChain.java

示例14: stopPlayerTracking

import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; //导入依赖的package包/类
public void stopPlayerTracking(EntityPlayerMP player)
{
    PlayerData oldData = playerTracking.get(player);
    
    if(oldData == null) return;
    
    synchronized(this)
    {
        Int2ObjectOpenHashMap<ExcavationRenderEntry> entries = this.get(oldData.dimensionID);
        if(entries != null && !entries.isEmpty())
        {
            for(ExcavationRenderEntry entry : entries.values())
            {
                if(entry.domainID == oldData.domainID) entry.removeListener(player);
            }
        }
    }
    
    playerTracking.remove(player);
}
 
开发者ID:grondag,项目名称:Hard-Science,代码行数:21,代码来源:ExcavationRenderTracker.java

示例15: load

import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; //导入依赖的package包/类
/**
 * List of lines are generated from a given file. then this list is used to generate a NodeNamerImpl
 *
 * @param file
 * @return INodeNamer
 * @throws IOException
 */
public static INodeNamer load(final File file) throws IOException {
    final int numNodes = countLines(file, Encoding.DEFAULT_CHARSET_NAME);

    final Int2ObjectOpenHashMap<String> id2Label = new Int2ObjectOpenHashMap<String>(numNodes);
    final Object2IntOpenHashMap<String> label2Id = new Object2IntOpenHashMap<String>(numNodes);

    final LineIterator it = FileUtils.lineIterator(file, Encoding.DEFAULT_CHARSET_NAME);
    try {
        int curId = 0;
        while(it.hasNext()) {
            final String nodeName = it.next();
            id2Label.put(curId, nodeName);
            label2Id.put(nodeName, curId);
            curId++;
        }

        return new NodeNamerImpl(id2Label, label2Id);
    } finally {
        it.close();
    }
}
 
开发者ID:sokolm,项目名称:LGA,代码行数:29,代码来源:NodeNamerImpl.java


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