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


Java Object2IntOpenHashMap.put方法代码示例

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


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

示例1: isUniqueWith

import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; //导入方法依赖的package包/类
public boolean isUniqueWith(int[][] compressedRecords, OpenBitSet otherAttrs, List<IntegerPair> comparisonSuggestions) {
	int attrsSize = (int) otherAttrs.cardinality();
	
	for (IntArrayList cluster : this.clusters) {
		Object2IntOpenHashMap<ClusterIdentifier> value2record = new Object2IntOpenHashMap<>(cluster.size());
		for (int recordId : cluster) {
			ClusterIdentifier value = this.buildClusterIdentifier(otherAttrs, attrsSize, compressedRecords[recordId]);
			if (value == null)
				continue;
			if (value2record.containsKey(value)) {
				comparisonSuggestions.add(new IntegerPair(recordId, value2record.getInt(value)));
				return false;
			}
			value2record.put(value, recordId);
		}
	}
	return true;
}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:19,代码来源:PositionListIndex.java

示例2: refines

import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; //导入方法依赖的package包/类
public boolean refines(int[][] lhsInvertedPlis, int[] rhs) {
	for (IntArrayList cluster : this.clusters) {
		Object2IntOpenHashMap<IntArrayList> clustersMap = new Object2IntOpenHashMap<>(cluster.size());
		
		// Check if all subclusters of this cluster point into the same other clusters
		for (int recordId : cluster) {
			IntArrayList additionalLhsCluster = this.buildClusterIdentifier(recordId, lhsInvertedPlis);
			if (additionalLhsCluster == null)
				continue;
			
			if (clustersMap.containsKey(additionalLhsCluster)) {
				if ((rhs[recordId] == -1) || (clustersMap.getInt(additionalLhsCluster) != rhs[recordId]))
					return false;
			}
			else {
				clustersMap.put(additionalLhsCluster, rhs[recordId]);
			}
		}
	}
	return true;
}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:22,代码来源:PositionListIndex.java

示例3: getEntityIdsMapping

import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; //导入方法依赖的package包/类
/**
 * @deprecated use {@link #readEntityIdsMapping(JavaRDD)} instead, to get the entity mappings used in blocking
 * Maps an entity url to its entity id, that is also used by blocking.
 * @param rawTriples
 * @param SEPARATOR
 * @return a map from an entity url to its entity id, that is also used by blocking.
 */
public static Object2IntOpenHashMap<String> getEntityIdsMapping(JavaRDD<String> rawTriples, String SEPARATOR) {        
    LinkedHashSet<String> subjectsSet =                  
        new LinkedHashSet<>(rawTriples
        .map(line -> line.split(SEPARATOR)[0])
        .collect()                
        ); //convert list to set (to remove duplicates)
    
    Object2IntOpenHashMap<String> result = new Object2IntOpenHashMap<>(subjectsSet.size());
    result.defaultReturnValue(-1);
    int index = 0;
    for (String subject : subjectsSet) {
        result.put(subject, index++);
    }
    return result;
}
 
开发者ID:vefthym,项目名称:MinoanER,代码行数:23,代码来源:Utils.java

示例4: load

import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; //导入方法依赖的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

示例5: run

import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; //导入方法依赖的package包/类
public static void run( final FastBufferedReader fbr, final DataOutputStream dos, ProgressLogger pl ) throws IOException {
	final MutableString s = new MutableString();
	Object2IntOpenHashMap<MutableString> map = new Object2IntOpenHashMap<MutableString>();
	map.defaultReturnValue( -1 );
	int slash, hostIndex = -1;

	if ( pl != null ) pl.start( "Reading URLS..." );
	while( fbr.readLine( s ) != null ) {
		slash = s.indexOf( '/', 8 );
		// Fix for non-BURL URLs
		if ( slash != -1 ) s.length( slash );
		if ( ( hostIndex = map.getInt( s ) ) == -1 ) map.put( s.copy(), hostIndex = map.size() );
		dos.writeInt( hostIndex );
		if ( pl != null ) pl.lightUpdate();
	}
	
	if ( pl != null ) pl.done();
}
 
开发者ID:lhelwerd,项目名称:WebGraph,代码行数:19,代码来源:BuildHostMap.java

示例6: processRecord

import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; //导入方法依赖的package包/类
public int processRecord(SAMRecord sr, Object2IntOpenHashMap<String> readLoadingSet){
int totalOp = 0;
String hlagene = HLA.extractHLAGeneName(sr.getReferenceName());
HLAGraph hg = this.hlaName2Graph.get(hlagene);
//hg.traverse();
if(hg != null){
    if(hg.isClassI()){
	boolean qc = this.qcCheck(sr);
	if(!qc)
	    return 0;
    }
    int readnum = readLoadingSet.getInt(sr.getReadName());
    //no such read has been read. return value of 0 means the hashSet doesn't have the read
    if(readnum == 0){
	readnum = sr.getFirstOfPairFlag() ? HLA.readNum : 0-HLA.readNum;
	
	readLoadingSet.put(sr.getReadName(), HLA.readNum);
	HLA.readNum++;
    }else
	readnum = sr.getFirstOfPairFlag() ? readnum : 0-readnum;

    totalOp += hg.addWeight(sr, readnum);//HLA.readNum);
    //HLA.readNum++;
}else{
    ;//HLA.log.appendln("UNKNOWN HLA GENE: " + hlagene);
}
return totalOp;
   }
 
开发者ID:Kingsford-Group,项目名称:kourami,代码行数:29,代码来源:HLA.java

示例7: createWordMap

import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; //导入方法依赖的package包/类
/**
 * Creates a (reversed) hash assignment from a String array, where the assignment is the index each string has in the original array
 *
 * @param x original string array
 * @return reversed hash assigment
 */
private Object2IntOpenHashMap<String> createWordMap( String[] x ) {
    Object2IntOpenHashMap<String> map = new Object2IntOpenHashMap<String>();
    for( int i = 0; i < x.length; i++ ) {
        map.put( x[ i ], i );
    }
    return map;
}
 
开发者ID:yahoo,项目名称:FEL,代码行数:14,代码来源:WordVectorsUtils.java

示例8: initializeGrids

import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; //导入方法依赖的package包/类
public void initializeGrids(
		Set<UUID> allActiveNodes, 
		Set<UUID> activeNeedsInputNodes, 
		Set<UUID> passiveNodes,
		Object2IntOpenHashMap<UUID> uuidToIntMap,
		Object2ObjectOpenHashMap<UUID, Commodity[]> uuidOutputMap,
		Object2ObjectOpenHashMap<UUID, Commodity[]> uuidInputMap) {
	
	Object2IntOpenHashMap<UUID> uuidToIntMapWithMeter = new Object2IntOpenHashMap<UUID>(uuidToIntMap);
	uuidToIntMapWithMeter.put(meterUUID, uuidToIntMap.size());
	
	Object2ObjectOpenHashMap<UUID, Commodity[]> uuidOutputMapWithMeter = new Object2ObjectOpenHashMap<UUID, Commodity[]>(uuidOutputMap);
	uuidOutputMapWithMeter.put(meterUUID, Commodity.values());
	
	Object2ObjectOpenHashMap<UUID, Commodity[]> uuidInputMapWithMeter = new Object2ObjectOpenHashMap<UUID, Commodity[]>(uuidInputMap);
	uuidInputMapWithMeter.put(meterUUID, Commodity.values());
	
	
	for (Entry<EnergySimulationTypes,EnergyGrid> grid : grids.entrySet()) {
		grid.getValue().initializeGrid(allActiveNodes, activeNeedsInputNodes, passiveNodes, uuidToIntMapWithMeter, uuidOutputMapWithMeter);
	}
	
	ObjectOpenHashSet<UUID> passiveWithMeter = new ObjectOpenHashSet<UUID>(passiveNodes);
	passiveWithMeter.add(meterUUID);
	
	a2pInputStateMap = new UUIDCommodityMap(passiveWithMeter, uuidToIntMapWithMeter, uuidInputMapWithMeter, true);
	
	p2aInputStateMap = new UUIDCommodityMap(activeNeedsInputNodes, uuidToIntMap, uuidInputMap, true);
}
 
开发者ID:organicsmarthome,项目名称:OSHv4,代码行数:30,代码来源:OCEnergySimulationCore.java

示例9: supportMap

import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; //导入方法依赖的package包/类
/**
 * Returns a map of discovered ItemSets and their support, where the support is the number of times the combination
 * appears in the input data
 */
public Object2IntOpenHashMap<int[]> supportMap() {
    List<ItemSet> itemSets = learn();
    Object2IntOpenHashMap<int[]> confidenceMap = new Object2IntOpenHashMap<>(itemSets.size());

    for (ItemSet itemSet : itemSets) {
        confidenceMap.put(itemSet.items, itemSet.support);
    }
    return confidenceMap;
}
 
开发者ID:jtablesaw,项目名称:tablesaw,代码行数:14,代码来源:FrequentItemset.java

示例10: test

import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; //导入方法依赖的package包/类
@Override
public int test() {
    final Object2IntOpenHashMap<Integer> m_map = new Object2IntOpenHashMap<>( m_keys.length, m_fillFactor );
    for ( int i = 0; i < m_keys.length; ++i )
        m_map.put( m_keys[ i ], i );
    for ( int i = 0; i < m_keys2.length; ++i )
        m_map.put( m_keys2[ i ], i );
    return m_map.size();
}
 
开发者ID:mikvor,项目名称:hashmapTest,代码行数:10,代码来源:FastUtilObjectIntMapTest.java

示例11: main

import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; //导入方法依赖的package包/类
/**
 * Creates the language model data structure given a file with the format
 * Type <TAB> (frequency, words), (frequency, words) ... Type <TAB>
 * (frequency, words), (frequency, words) ... ....
 *
 * @param args command line arguments
 * @throws JSAPException
 * @throws IOException
 */
public static void main( String args[] ) throws JSAPException, IOException {
    SimpleJSAP jsap = new SimpleJSAP( TypeLanguageModel.class.getName(), "Language model for types builder", new Parameter[]{ new FlaggedOption( "input", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, 'i', "input", "Input file" ), new FlaggedOption( "output", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.NOT_REQUIRED, 'o', "output", "File to serialize the data structure" ), } );
    JSAPResult jsapResult = jsap.parse( args );
    if( jsap.messagePrinted() ) return;

    final BufferedReader lines = new BufferedReader( new FileReader( jsapResult.getString( "input" ) ) );

    Object2ObjectLinkedOpenHashMap<String, Object2IntOpenHashMap<String>> languageModels = new Object2ObjectLinkedOpenHashMap<String, Object2IntOpenHashMap<String>>();
    Object2IntOpenHashMap<String> freqs = new Object2IntOpenHashMap<String>();
    Object2IntOpenHashMap<String> background = new Object2IntOpenHashMap<String>();
    int totalFreq = 0;
    String line = "";
    while( ( line = lines.readLine() ) != null ) {
        String[] parts = line.split( "\t" );
        Object2IntOpenHashMap<String> typeHash = languageModels.get( parts[ 0 ] );
        if( typeHash == null ) {
            typeHash = new Object2IntOpenHashMap<String>();
            languageModels.put( parts[ 0 ], typeHash );
            freqs.put( parts[ 0 ], 0 );
        }
        String[] scoreAndModifier = parts[ 1 ].split( "," );
        Integer freqI = 0;
        for( String s : scoreAndModifier ) {
            Matcher m = Pattern.compile( "(\\()(.+)" ).matcher( s ); // freq
            if( m.find() ) {
                Double freqD = ( Double.parseDouble( m.group( 2 ) ) ); //might break if input is ill-formed
                freqI = freqD.intValue();
            }

            m = Pattern.compile( "(.+?)(\\))" ).matcher( s );
            if( m.find() ) { //words
                String[] tmpQ = Normalize.normalize( m.group( 1 ) ).trim().split( "\\s" );
                //generate unigrams + bigrams + trigrams

                for( String queryS : getTrigrams( tmpQ ) ) {
                    Integer freq = typeHash.get( queryS );
                    if( freq == null ) {
                        typeHash.put( queryS, 0 );
                        background.put( queryS, 0 );
                    }
                    freqs.addTo( parts[ 0 ], freqI );
                    typeHash.addTo( queryS, freqI );
                    background.addTo( queryS, freqI );
                    totalFreq += freqI;
                }
            }
        }
    }
    lines.close();
    TypeLanguageModel model = new TypeLanguageModel();
    model.languageModels = languageModels;
    model.freqs = freqs;
    model.totalFreq = totalFreq;
    model.backgroundModel = background;
    BinIO.storeObject( model, jsapResult.getString( "output" ) );
}
 
开发者ID:yahoo,项目名称:FEL,代码行数:66,代码来源:TypeLanguageModel.java


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