• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Object2ObjectOpenHashMap类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: HashIndex

import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; //导入依赖的package包/类
/**
 * Create a HashIndex that can be used when executing queries.
 * 
 * @param indexName the name of this index, used for statistics collection
 * @param indexedExpression the expression to index on, a function dependent on region entries
 *        individually, limited to a path expression.
 * @param fromClause expression that evaluates to the collection(s) that will be queried over,
 *        must contain one and only one region path, and only one iterator.
 * @param projectionAttributes not used
 * @param definitions the canonicalized definitions
 */
public HashIndex(String indexName, Region region, String fromClause, String indexedExpression,
    String projectionAttributes, String origFromClause, String origIndexExpr,
    String[] definitions, IndexStatistics stats) {
  super(indexName, region, fromClause, indexedExpression, projectionAttributes, origFromClause,
      origIndexExpr, definitions, stats);
  RegionAttributes ra = region.getAttributes();


  if (IndexManager.isObjectModificationInplace()) {
    entryToValuesMap = new ConcurrentHashMap(ra.getInitialCapacity(), ra.getLoadFactor(),
        ra.getConcurrencyLevel());
  } else {
    if (entryToOldKeysMap == null) {
      entryToOldKeysMap = new ThreadLocal<Object2ObjectOpenHashMap>();
    }
  }

  entriesSet = new HashIndexSet();
}
 
开发者ID:ampool,项目名称:monarch,代码行数:31,代码来源:HashIndex.java


示例2: removeMapping

import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; //导入依赖的package包/类
/**
 * @param opCode one of OTHER_OP, BEFORE_UPDATE_OP, AFTER_UPDATE_OP.
 */
void removeMapping(RegionEntry entry, int opCode) throws IMQException {
  // logger.debug("##### In RemoveMapping: entry : "
  // + entry );
  if (opCode == BEFORE_UPDATE_OP) {
    // Either take key from reverse map OR evaluate it using IMQEvaluator.
    if (!IndexManager.isObjectModificationInplace()) {
      // It will always contain 1 element only, for this thread.
      entryToOldKeysMap.set(new Object2ObjectOpenHashMap(1));
      this.evaluator.evaluate(entry, false);
    }
  } else {
    // Need to reset the thread-local map as many puts and destroys might
    // happen in same thread.
    if (entryToOldKeysMap != null) {
      entryToOldKeysMap.remove();
    }
    this.evaluator.evaluate(entry, false);
    this.internalIndexStats.incNumUpdates();
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:24,代码来源:HashIndex.java


示例3: writeProperties

import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; //导入依赖的package包/类
public void writeProperties(Object2ObjectOpenHashMap<String,DataRef> props) {
    try {
        writer.writeStartObject();
        for (Object2ObjectMap.Entry<String, DataRef> entry : props.object2ObjectEntrySet()) {
            writer.writeFieldName(entry.getKey());
            if(entry.getValue() instanceof CoreRef) {
                CoreRef prop =  (CoreRef)(entry.getValue());
                prop.write(propwriter);
            }
            else
                throw new UnsupportedOperationException("Only CoreRefs are supported for encoding.");
        }

        writer.writeEndObject();
    } catch (IOException e) {
        throw new IOError(e);
    }
}
 
开发者ID:marcusklang,项目名称:docforia,代码行数:19,代码来源:MemoryJsonLevel0Codec.java


示例4: printClusters

import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; //导入依赖的package包/类
/**
 * Outputs on stdout the different clusters computed
 *
 * @param cluster word clusters
 */
public void printClusters( Object2ObjectOpenHashMap<String, ClusterEntry> cluster ) {
    int k = -1;
    for( ClusterEntry jj : cluster.values() ) {
        if( jj.cluster > k ) k = jj.cluster;
    }
    k++;
    for( int i = 0; i < k; i++ ) {
        for( String s : cluster.keySet() ) {
            if( cluster.get( s ).cluster == i ) {
                //if ( cluster.get( s ).score > 0.5 )
                System.out.println( s + "\t" + i + "\t" + cluster.get( s ).score );
            }
        }
    }
}
 
开发者ID:yahoo,项目名称:FEL,代码行数:21,代码来源:WordVectorsUtils.java


示例5: cluster

import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; //导入依赖的package包/类
/**
 * k-means of the words in the vector file
 * @param k number of clusters
 * @param map vector
 * @return clustering of the words in the vector
 */
public Object2ObjectOpenHashMap<String, ClusterEntry> cluster( final int k, final UncompressedWordVectors map ) {
    final int len = map.vectors.keySet().size();
    int[] original = new int[ len ];
    Random r = new Random();
    for( int i = 0; i < k; i++ ) {
        original[ i ] = i;
    }
    for( int i = k + 1; i < len; i++ ) {
        original[ i ] = r.nextInt( k );
    }

    String[] words = new String[ map.vectors.keySet().size() ];
    int z = 0;
    for( String s : map.vectors.keySet() ) {
        words[ z++ ] = s;
    }
    return cluster( k, map, original, words );
}
 
开发者ID:yahoo,项目名称:FEL,代码行数:25,代码来源:WordVectorsUtils.java


示例6: assignClosest

import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; //导入依赖的package包/类
/**
 * Returns the closest word in the vector file
 * @param map vectors
 * @param words input words
 * @return a list of closest words to the input ones
 */
public Object2ObjectOpenHashMap<String, ClusterEntry> assignClosest( final UncompressedWordVectors map, ArrayList<String> words ) {
    final int d = map.getVectorLength();
    Object2ObjectOpenHashMap<String, ClusterEntry> assignment = new Object2ObjectOpenHashMap<String, ClusterEntry>();
    for( String w : map.vectors.keySet() ) {
        float maxSim = -1;
        int bestWord = -1;
        for( int j = 0; j < words.size(); j++ ) {
            final float s = sim( map.vectors.get( w ), map.vectors.get( words.get( j ) ), d );
            if( s > maxSim ) {
                maxSim = s;
                bestWord = j;
            }
        }
        ClusterEntry e = new ClusterEntry();
        e.cluster = bestWord;
        e.score = maxSim;
        assignment.put( w, e );
    }
    return assignment;
}
 
开发者ID:yahoo,项目名称:FEL,代码行数:27,代码来源:WordVectorsUtils.java


示例7: read

import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; //导入依赖的package包/类
public static UncompressedWordVectors read( String file ) throws IOException {
    Object2ObjectOpenHashMap<String, float[]> map = new Object2ObjectOpenHashMap<String, float[]>();
    final BufferedReader lines = new BufferedReader( new FileReader( file ) );
    String line;
    while( ( line = lines.readLine() ) != null ) {
        String parts[] = line.split( "\t" );
        float[] values = new float[ parts.length - 1 ];
        for( int i = 1; i < parts.length; i++ ) {
            values[ i - 1 ] = Float.parseFloat( parts[ i ] );
        }
        map.put( parts[ 0 ], values );
    }
    lines.close();
    UncompressedWordVectors vector = new UncompressedWordVectors();
    vector.vectors = map;
    return vector;
}
 
开发者ID:yahoo,项目名称:FEL,代码行数:18,代码来源:UncompressedWordVectors.java


示例8: getVertexMessagesImproved

import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; //导入依赖的package包/类
public Iterable<M> getVertexMessagesImproved(I vertexId, int pId) throws IOException {

        Object2ObjectOpenHashMap<I,DataInputOutput[]> partitionMap = new_map[pId];
        DataInputOutput[] vertex_map_entry = partitionMap.get(vertexId);
        if( vertex_map_entry == null)
        {
            return EmptyIterable.get();
        }
        reentrant_locks[pId].readLock().lock();
        try {
            int current_index = getCurrentIndex(pId,vertexId);
            DataInputOutput result =  vertex_map_entry[current_index];
            resetCurrentIndex(pId,vertexId, current_index);
            ((UnsafeByteArrayOutputStream) ((ExtendedDataInputOutput)  vertex_map_entry[getCurrentIndex(pId,vertexId)]).getDataOutput()).reset();
            synchronized (has_messages_map[pId]) {
                has_messages_map[pId].remove(vertexId);
            }
            return new MessagesIterable<M>(result, messageValueFactory);
        } finally {
        reentrant_locks[pId].readLock().unlock();
        }
    }
 
开发者ID:wmoustafa,项目名称:granada,代码行数:23,代码来源:ByteArrayMessagesPerVertexStore.java


示例9: getVertexMessagesImproved

import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; //导入依赖的package包/类
public Iterable<M> getVertexMessagesImproved(I vertexId, int pId) throws IOException {

        Object2ObjectOpenHashMap<I,M[]> partitionMap = new_map[pId];
        M[] vertex_map_entry = partitionMap.get(vertexId);
        if( vertex_map_entry == null)
        {
            return EmptyIterable.get();
        }

        reentrant_locks[pId].readLock().lock();
        try {
            int current_index = getCurrentIndex(pId, vertexId);
            M result = vertex_map_entry[current_index];
            resetCurrentIndex(pId, vertexId, current_index);
            vertex_map_entry[getCurrentIndex(pId, vertexId)] = messageCombiner.createInitialMessage();
            synchronized (has_messages_map[pId]) {
                has_messages_map[pId].remove(vertexId);
            }
            return Collections.singleton(result);
        } finally {
            reentrant_locks[pId].readLock().unlock();
        }

    }
 
开发者ID:wmoustafa,项目名称:granada,代码行数:25,代码来源:OneMessagePerVertexStore.java


示例10: UUIDCommodityMap

import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; //导入依赖的package包/类
public UUIDCommodityMap(Set<UUID> allUUIDs, 
		Object2IntOpenHashMap<UUID> uuidIntMap,
		Object2ObjectOpenHashMap<UUID, Commodity[]> uuidInputMap,
		boolean makeNoMap) {
	keyMap = null;
	partIdToArrayIdMap = new int[uuidIntMap.size()];
	innerValues = new LimitedCommodityStateMap[allUUIDs.size()];
	
	Arrays.fill(partIdToArrayIdMap, -1);
	
	Iterator<UUID> it = allUUIDs.iterator();
	for (int i = 0; i < allUUIDs.size(); i++) {
		UUID curr = it.next();
		if (uuidIntMap.containsKey(curr)) {
			partIdToArrayIdMap[uuidIntMap.getInt(curr)] = i;
			innerValues[i] = new LimitedCommodityStateMap(uuidInputMap.get(curr));
		} else {
			throw new IllegalArgumentException("no mapping for specified key");
		}
	}
}
 
开发者ID:organicsmarthome,项目名称:OSHv4,代码行数:22,代码来源:UUIDCommodityMap.java


示例11: PooledDatasetChecker

import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; //导入依赖的package包/类
public PooledDatasetChecker(GroundTruth evaluations, ImmutableGraph g, UnexpectednessScorer[] pool, Int2ObjectMap<String> id2name) throws IOException {
	this.graph = g;
	this.pool = pool;
	this.evaluations = evaluations;
	this.id2name = id2name;
	SummaryStatistics[] stats = new SummaryStatistics[pool.length];
	for (int i = 0; i < stats.length; i++)
		stats[i] = new SummaryStatistics();
	retriever2itsFraction = new Object2ObjectOpenHashMap<UnexpectednessScorer, SummaryStatistics>(pool, stats);
	for (int i = 0; i < stats.length; i++)
		stats[i] = new SummaryStatistics();
	retriever2evaluatedTopResults = new Object2ObjectOpenHashMap<UnexpectednessScorer, SummaryStatistics>(pool, stats);
	unmatchStats = new SummaryStatistics();

	System.out.println(evaluations.stats());
}
 
开发者ID:corradomonti,项目名称:llamafur,代码行数:17,代码来源:PooledDatasetChecker.java


示例12: tag

import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; //导入依赖的package包/类
/**
 * Add a tag to the element.
 *
 * @param key   The key of the tag.
 * @param value The value of the tag.
 * @return      The previous value of the key, if any.
 */
public final String tag(final String key, final String value) {
  if (key == null || value == null) {
    return null;
  }

  String k = key.trim();
  String v = value.trim();

  if (k.isEmpty() || v.isEmpty()) {
    return null;
  }

  if (this.tags == null) {
    this.tags = new Object2ObjectOpenHashMap<>(INITIAL_TAG_CAPACITY);
  }

  return this.tags.put(STRING_POOL.get(k), STRING_POOL.get(v));
}
 
开发者ID:kasperisager,项目名称:kelvin-maps,代码行数:26,代码来源:Element.java


示例13: search

import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; //导入依赖的package包/类
/**
 * Given a prefix, find all keys within the ternary search tree that contain
 * the specified prefix.
 *
 * @param prefix  The prefix to search for.
 * @return        A map of matching keys and their associated values.
 */
public final Map<String, V> search(final String prefix) {
  Map<String, V> results = new Object2ObjectOpenHashMap<>();

  if (prefix == null) {
    return results;
  }

  Node<V> root = this.get(this.root, prefix, 0);

  if (root == null) {
    return results;
  }

  if (root.value != null) {
    results.put(prefix, root.value);
  }

  this.search(root.equal, new StringBuilder(prefix), results);

  return results;
}
 
开发者ID:kasperisager,项目名称:kelvin-maps,代码行数:29,代码来源:TernarySearchTree.java


示例14: average

import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; //导入依赖的package包/类
public Weights<T> average() {
	System.err.print("averaging (this may take a while)... ");
	Weights<T> result = new Weights<T>(opts, true);
	result.data = new Object2ObjectOpenHashMap<>();
	result.index = index;
	result.gram = gram;
	int cnt = 0;
	for (String feat : data.keySet()) {
		FeatureWeights dw = data.get(feat);
		if (dw.used > opts.minupdate) {
			cnt++;
			FeatureWeights fw = new FeatureWeights();
			for (int trans : index.indices()) {
				float averaged = dw.getAveraged(trans, i);
				if (!Float.isNaN(averaged)) {
					fw.increment(trans, averaged, 0);
				}
			}
			result.data.put(feat, fw);
		}
	}
	System.err.println("done, averaged " + cnt + " features.");
	return result;
}
 
开发者ID:wmaier,项目名称:uparse,代码行数:25,代码来源:Weights.java


示例15: initTransitionsMaps

import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; //导入依赖的package包/类
/**
 * Initializes internal data structures for transitions.
 */
private void initTransitionsMaps() {
	if (trId2bpnMap == null) {
		trId2bpnMap = new Object2LongOpenHashMap<String>();
		trId2bpnMap.defaultReturnValue(-1L);
	}
	if (tr2InPlacesMap == null) {
		tr2InPlacesMap = new Long2ObjectOpenHashMap<>();
		tr2InPlacesMap.defaultReturnValue(null);
	}
	if (tr2OutPlacesMap == null) {
		tr2OutPlacesMap = new Long2ObjectOpenHashMap<>();
		tr2OutPlacesMap.defaultReturnValue(null);
	}
	if (tr2InAllArcsMap == null) {
		tr2InAllArcsMap = new Object2ObjectOpenHashMap<String, LongBigArrayBigList>();
		tr2InAllArcsMap.defaultReturnValue(null);
	}
	if (tr2OutAllArcsMap == null) {
		tr2OutAllArcsMap = new Object2ObjectOpenHashMap<String, LongBigArrayBigList>();
		tr2OutAllArcsMap.defaultReturnValue(null);
	}
}
 
开发者ID:lip6,项目名称:pnml2nupn,代码行数:26,代码来源:PNML2NUPNExporter.java


示例16: StrippedPartition

import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; //导入依赖的package包/类
/**
 * Create a StrippedPartition from a HashMap mapping the values to the tuple ids.
 *
 * @param partition
 */
public StrippedPartition(Object2ObjectOpenHashMap<Object, LongBigArrayBigList> partition) {
    this.strippedPartition = new ObjectBigArrayBigList<LongBigArrayBigList>();
    this.elementCount = 0;

    //create stripped partitions -> only use equivalence classes with size > 1.
    for (LongBigArrayBigList eqClass : partition.values()) {
        if (eqClass.size64() > 1) {
            strippedPartition.add(eqClass);
            elementCount += eqClass.size64();
        }
    }
    this.calculateError();
}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:19,代码来源:StrippedPartition.java


示例17: generateNextLevel

import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; //导入依赖的package包/类
private void generateNextLevel() {
        // System.out.println("Start generateNextLevel");
        level0 = level1;
        level1 = null;
        System.gc();

        Object2ObjectOpenHashMap<OpenBitSet, CombinationHelper> new_level = new Object2ObjectOpenHashMap<OpenBitSet, CombinationHelper>();

        buildPrefixBlocks();

        for (ObjectArrayList<OpenBitSet> prefix_block_list : prefix_blocks.values()) {

            // continue only, if the prefix_block contains at least 2 elements
            if (prefix_block_list.size() < 2) {
                continue;
            }

            ObjectArrayList<OpenBitSet[]> combinations = getListCombinations(prefix_block_list);
            for (OpenBitSet[] c : combinations) {
                OpenBitSet X = (OpenBitSet) c[0].clone();
                X.or(c[1]);

                if (checkSubsets(X)) {
                    StrippedPartition st = multiply(level0.get(c[0]).getPartition(), level0.get(c[1]).getPartition());
                    OpenBitSet rhsCandidates = new OpenBitSet();
//					 rhsCandidates.set(1, numberAttributes+1);

                    CombinationHelper ch = new CombinationHelper();
                    ch.setPartition(st);
                    ch.setRhsCandidates(rhsCandidates);

                    new_level.put(X, ch);
                }
            }
        }

        level1 = new_level;
    }
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:39,代码来源:TaneAlgorithmFilterTreeEnd.java


示例18: generateNextLevel

import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; //导入依赖的package包/类
private void generateNextLevel() {
        // System.out.println("Start generateNextLevel");
        level0 = level1;
        level1 = null;
        System.gc();

        Object2ObjectOpenHashMap<OpenBitSet, CombinationHelper> new_level = new Object2ObjectOpenHashMap<OpenBitSet, CombinationHelper>();

        buildPrefixBlocks();

        for (ObjectArrayList<OpenBitSet> prefix_block_list : prefix_blocks.values()) {

            // continue only, if the prefix_block contains at least 2 elements
            if (prefix_block_list.size() < 2) {
                continue;
            }

            ObjectArrayList<OpenBitSet[]> combinations = getListCombinations(prefix_block_list);
            for (OpenBitSet[] c : combinations) {
                OpenBitSet X = (OpenBitSet) c[0].clone();
                X.or(c[1]);

                if (checkSubsets(X)) {
                    StrippedPartition st = multiply(level0.get(c[0]).getPartition(), level0.get(c[1]).getPartition());
                    OpenBitSet rhsCandidates = new OpenBitSet();
//					 rhsCandidates.set(1, numberAttributes+1);

                    CombinationHelper ch = new CombinationHelper();
                    ch.setPartition(st);
                    ch.setRhsCandidates(rhsCandidates);

                    new_level.put(X, ch);
                }
            }
        }

        level1 = new_level;
//		System.out.println("Finished generateNextLevel");
    }
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:40,代码来源:TaneAlgorithmFilterTreeDirect.java


示例19: toString

import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; //导入依赖的package包/类
@Override
public String toString() {
	final Class<?> thisClass = getClass();
	final Map<String,Object> values = new Object2ObjectOpenHashMap<>();
	for (final Field f : thisClass.getDeclaredFields()) {
		if ((f.getModifiers() & Modifier.PUBLIC) == 0 || (f.getModifiers() & Modifier.STATIC) != 0) continue;
		try {
			values.put(f.getName(), f.get(this));
		} catch (final IllegalAccessException e) {
			values.put(f.getName(), "<THIS SHOULD NOT HAPPEN>");
		}
	}
	return values.toString();
}
 
开发者ID:LAW-Unimi,项目名称:BUbiNG,代码行数:15,代码来源:StartupConfiguration.java


示例20: writeProperties

import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; //导入依赖的package包/类
private void writeProperties(Object2ObjectOpenHashMap<String,DataRef> props, Output writer) {
    BinaryCoreWriter propwriter = new BinaryCoreWriter(writer);
    writer.writeInt(props.size());
    for (Object2ObjectMap.Entry<String, DataRef> entry : props.object2ObjectEntrySet()) {
        writer.writeString(entry.getKey());
        if(entry.getValue() instanceof CoreRef) {
            CoreRef prop =  (CoreRef)(entry.getValue());
            writer.writeByte(prop.id().value);
            prop.write(propwriter);
        }
        else
            throw new UnsupportedOperationException("Only CoreRefs are supported for encoding.");
    }
}
 
开发者ID:marcusklang,项目名称:docforia,代码行数:15,代码来源:MemoryBinaryV1L0Codec.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Get类代码示例发布时间:2022-05-21
下一篇:
Java Landmark类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap