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


Java Object2ObjectOpenHashMap.get方法代码示例

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


在下文中一共展示了Object2ObjectOpenHashMap.get方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: addPartitionMessages

import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; //导入方法依赖的package包/类
@Override
@edu.umd.cs.findbugs.annotations.SuppressFBWarnings(value = "NP_LOAD_OF_KNOWN_NULL_VALUE",
        justification="I know what I am doing")
public void addPartitionMessages( int partitionId, VertexIdMessages<I, M> messages) throws IOException {

    Object2ObjectOpenHashMap<I,DataInputOutput[]> partitionMap = new_map[partitionId];


    VertexIdMessageIterator<I, M> vertexIdMessageIterator = messages.getVertexIdMessageIterator();
    while (vertexIdMessageIterator.hasNext()) {
        vertexIdMessageIterator.next();
        I vertex_id = vertexIdMessageIterator.releaseCurrentVertexId();
        DataInputOutput[] vertex_map_entry = partitionMap.get(vertex_id);
        if (vertex_map_entry == null) {
            reentrant_locks[partitionId].writeLock().lock();
            try {
                if (vertex_map_entry == null) {
                    vertex_map_entry = new DataInputOutput[2];
                    partitionMap.put(vertex_id, vertex_map_entry);
                    vertex_map_entry[0] = (config.createMessagesInputOutput());
                    vertex_map_entry[1] = (config.createMessagesInputOutput());
                    setCurrentIndex(partitionId, vertex_id, 0);
                }
            }
            finally {
                reentrant_locks[partitionId].writeLock().unlock();
            }
        }
        reentrant_locks[partitionId].readLock().lock();
        synchronized (vertex_map_entry) {
            try {
                DataInputOutput dataInputOutput = vertex_map_entry[getCurrentIndex(partitionId, vertex_id)];
                VerboseByteStructMessageWrite.verboseWriteCurrentMessage(vertexIdMessageIterator,
                        dataInputOutput.getDataOutput());
                synchronized (has_messages_map[partitionId]) {
                    has_messages_map[partitionId].put(vertex_id, true);
                }
            } finally {
                reentrant_locks[partitionId].readLock().unlock();
            }
        }
    }

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

示例6: addPartitionMessages

import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; //导入方法依赖的package包/类
@Override
@edu.umd.cs.findbugs.annotations.SuppressFBWarnings(value = "NP_LOAD_OF_KNOWN_NULL_VALUE",
        justification="I know what I am doing")
public void addPartitionMessages( int partitionId, VertexIdMessages<I, M> messages) throws IOException {

    Object2ObjectOpenHashMap<I,M[]> partitionMap = new_map[partitionId];


    VertexIdMessageIterator<I, M> vertexIdMessageIterator = messages.getVertexIdMessageIterator();
    while (vertexIdMessageIterator.hasNext()) {
        vertexIdMessageIterator.next();

        I vertex_id = vertexIdMessageIterator.releaseCurrentVertexId();
        M[] vertex_map_entry = partitionMap.get(vertex_id);
        if (vertex_map_entry == null) {
            reentrant_locks[partitionId].writeLock().lock();
            try {
                if (vertex_map_entry == null) {
                    vertex_map_entry = (M[]) new Writable[2];
                    partitionMap.put(vertex_id, vertex_map_entry);
                    vertex_map_entry[0] = messageCombiner.createInitialMessage();
                    vertex_map_entry[1] = messageCombiner.createInitialMessage();
                    setCurrentIndex(partitionId, vertex_id, 0);

                }
            } finally {
                reentrant_locks[partitionId].writeLock().unlock();
            }
        }
        reentrant_locks[partitionId].readLock().lock();
        synchronized (vertex_map_entry) {
            try {
                messageCombiner.combine(vertex_id, vertex_map_entry[getCurrentIndex(partitionId, vertex_id)],
                        vertexIdMessageIterator.getCurrentMessage());
                synchronized (has_messages_map[partitionId]) {
                    has_messages_map[partitionId].put(vertex_id, true);
                }
            } finally {
                reentrant_locks[partitionId].readLock().unlock();
            }
        }
    }
}
 
开发者ID:wmoustafa,项目名称:granada,代码行数:44,代码来源:OneMessagePerVertexStore.java


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