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


Java TObjectIntHashMap类代码示例

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


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

示例1: buildAccessors

import gnu.trove.map.hash.TObjectIntHashMap; //导入依赖的package包/类
private static TObjectIntMap<String> buildAccessors(int accessFlags) {
    TObjectIntMap<String> map = new TObjectIntHashMap<>();
    map.put("public", Modifier.isPublic(accessFlags) ? 1 : 0);
    map.put("protected", Modifier.isProtected(accessFlags) ? 1 : 0);
    map.put("private", Modifier.isPrivate(accessFlags) ? 1 : 0);
    map.put("final", Modifier.isFinal(accessFlags) ? 1 : 0);
    map.put("interface", Modifier.isInterface(accessFlags) ? 1 : 0);
    map.put("native", Modifier.isNative(accessFlags) ? 1 : 0);
    map.put("static", Modifier.isStatic(accessFlags) ? 1 : 0);
    map.put("strict", Modifier.isStrict(accessFlags) ? 1 : 0);
    map.put("synchronized", Modifier.isSynchronized(accessFlags) ? 1 : 0);
    map.put("transient", Modifier.isTransient(accessFlags) ? 1 : 0);
    map.put("volatile", Modifier.isVolatile(accessFlags) ? 1 : 0);
    map.put("abstract", Modifier.isAbstract(accessFlags) ? 1 : 0);
    return map;
}
 
开发者ID:CalebFenton,项目名称:apkfile,代码行数:17,代码来源:DexMethod.java

示例2: collectAllItinClasses

import gnu.trove.map.hash.TObjectIntHashMap; //导入依赖的package包/类
/**
 * Gathers and enumerates all the itinerary classes.
 * Returns itinerary class count.
 * @param os
 * @param itinClassesMap
 * @return
 */
private int collectAllItinClasses(PrintStream os, TObjectIntHashMap<String> itinClassesMap)
        throws Exception
{
    ArrayList<Record> itinClassList = records.getAllDerivedDefinition("InstrItinClass");

    itinClassList.sort(LessRecord);

    // for each itinenary class.
    int n = itinClassList.size();
    for (int i = 0; i < n; i++)
    {
        Record itinClass = itinClassList.get(i);
        itinClassesMap.put(itinClass.getName(), i);
    }

    return n;
}
 
开发者ID:JianpingZeng,项目名称:xcc,代码行数:25,代码来源:SubtargetEmitter.java

示例3: emitData

import gnu.trove.map.hash.TObjectIntHashMap; //导入依赖的package包/类
/**
 * Emits all stages and itineries, folding common patterns.
 * @param os
 */
private void emitData(PrintStream os) throws Exception
{
    TObjectIntHashMap<String> itinClassesMap = new TObjectIntHashMap<>();
    ArrayList<ArrayList<InstrItinerary>> procList = new ArrayList<>();

    // Enumerate all the itinerary classes
    int nitinCLasses = collectAllItinClasses(os, itinClassesMap);
    // Make sure the rest is worth the effort
    hasItrineraries = nitinCLasses != 1;

    if (hasItrineraries)
    {
        // Emit the stage data
        emitStageAndOperandCycleData(os, nitinCLasses, itinClassesMap, procList);
        // Emit the processor itinerary data
        emitProcessorData(os, procList);
        // Emit the processor lookup data
        emitProcessorLookup(os);
    }
}
 
开发者ID:JianpingZeng,项目名称:xcc,代码行数:25,代码来源:SubtargetEmitter.java

示例4: findDepVarsOf

import gnu.trove.map.hash.TObjectIntHashMap; //导入依赖的package包/类
private void findDepVarsOf(TreePatternNode node, TObjectIntHashMap<String> depMap)
{
    if (node.isLeaf())
    {
        if (node.getLeafValue() instanceof DefInit)
        {
            if (depMap.containsKey(node.getName()))
                depMap.put(node.getName(), depMap.get(node.getName()) + 1);
            else
                depMap.put(node.getName(), 1);
        }
    }
    else
    {
        for (int i = 0, e = node.getNumChildren(); i != e; i++)
            findDepVarsOf(node.getChild(i), depMap);
    }
}
 
开发者ID:JianpingZeng,项目名称:xcc,代码行数:19,代码来源:CodeGenDAGPatterns.java

示例5: PromoteMemToReg

import gnu.trove.map.hash.TObjectIntHashMap; //导入依赖的package包/类
public PromoteMemToReg(ArrayList<AllocaInst> allocas,
           DomTree dt,
           DominanceFrontier df,
           AliasSetTracker ast)
{
	this.allocas = allocas;
	this.dt = dt;
	this.df = df;
	this.ast = ast;
	allocaLookup = new TObjectIntHashMap<>();
	newPhiNodes = new HashMap<>();
	visitedBlocks = new HashSet<>();
	bbNumbers = new TObjectIntHashMap<>();
	phiToAllocaMap = new TObjectIntHashMap<>();
	pointerAllocaValues = new ArrayList<>();
}
 
开发者ID:JianpingZeng,项目名称:xcc,代码行数:17,代码来源:PromoteMemToReg.java

示例6: runOnMachineFunction

import gnu.trove.map.hash.TObjectIntHashMap; //导入依赖的package包/类
/**
 * This method must be overridded by concrete subclass for performing
 * desired machine code transformation or analysis.
 *
 * @param mf
 * @return
 */
@Override
public boolean runOnMachineFunction(MachineFunction mf)
{
	this.mf = mf;
	tm = mf.getTarget();
	regInfo = tm.getRegisterInfo();
	instrInfo = tm.getInstrInfo();

	stackSlotForVirReg = new TIntIntHashMap();
	regUsed = new BitMap();
	regClassIdx = new TObjectIntHashMap<>();

	for (MachineBasicBlock mbb : mf.getBasicBlocks())
		allocateBasicBlock(mbb);

	stackSlotForVirReg.clear();
	return true;
}
 
开发者ID:JianpingZeng,项目名称:xcc,代码行数:26,代码来源:RegAllocSimple.java

示例7: testGetMap

import gnu.trove.map.hash.TObjectIntHashMap; //导入依赖的package包/类
public void testGetMap() {
    int element_count = 20;
    String[] keys = new String[element_count];
    int[] vals = new int[element_count];

    TObjectIntMap<String> raw_map = new TObjectIntHashMap<String>();
    for ( int i = 0; i < element_count; i++ ) {
        keys[i] = Integer.toString( i + 1 );
        vals[i] = i + 1;
        raw_map.put( keys[i], vals[i] );
    }
    //noinspection MismatchedQueryAndUpdateOfCollection
    TObjectIntMapDecorator<String> map = new TObjectIntMapDecorator<String>( raw_map );

    assertEquals( raw_map, map.getMap() );
}
 
开发者ID:palantir,项目名称:trove-3.0.3,代码行数:17,代码来源:TObjectPrimitiveMapDecoratorTest.java

示例8: testContainsKey

import gnu.trove.map.hash.TObjectIntHashMap; //导入依赖的package包/类
public void testContainsKey() {
    int element_count = 20;
    String[] keys = new String[element_count];
    int[] vals = new int[element_count];

    TObjectIntMap<String> map = new TObjectIntHashMap<String>();
    for ( int i = 0; i < element_count; i++ ) {
        keys[i] = Integer.toString( i + 1 );
        vals[i] = i + 1;
        map.put( keys[i], vals[i] );
    }

    for ( int i = 0; i < element_count; i++ ) {
        assertTrue( "Key should be present: " + keys[i] + ", map: " + map,
                map.containsKey( keys[i] ) );
    }

    String key = "1138";
    assertFalse( "Key should not be present: " + key + ", map: " + map,
            map.containsKey( key ) );

    assertFalse( "Random object should not be present in map: " + map,
            map.containsKey( new Object() ) );
}
 
开发者ID:palantir,项目名称:trove-3.0.3,代码行数:25,代码来源:TObjectPrimitiveMapDecoratorTest.java

示例9: testContainsValue

import gnu.trove.map.hash.TObjectIntHashMap; //导入依赖的package包/类
public void testContainsValue() {
    int element_count = 20;
    String[] keys = new String[element_count];
    int[] vals = new int[element_count];

    TObjectIntMap<String> map = new TObjectIntHashMap<String>();
    for ( int i = 0; i < element_count; i++ ) {
        keys[i] = Integer.toString( i + 1 );
        vals[i] = i + 1;
        map.put( keys[i], vals[i] );
    }

    for ( int i = 0; i < element_count; i++ ) {
        assertTrue( "Value should be present: " + vals[i] + ", map: " + map,
                map.containsValue( vals[i] ) );
    }

    int val = 1138;
    assertFalse( "Key should not be present: " + val + ", map: " + map,
            map.containsValue( val ) );
}
 
开发者ID:palantir,项目名称:trove-3.0.3,代码行数:22,代码来源:TObjectPrimitiveMapDecoratorTest.java

示例10: testPutAllMap

import gnu.trove.map.hash.TObjectIntHashMap; //导入依赖的package包/类
public void testPutAllMap() {
    int element_count = 20;
    String[] keys = new String[element_count];
    int[] vals = new int[element_count];

    TObjectIntMap<String> control = new TObjectIntHashMap<String>();
    for ( int i = 0; i < element_count; i++ ) {
        keys[i] = Integer.toString( i + 1 );
        vals[i] = i + 1;
        control.put( keys[i], vals[i] );
    }

    TObjectIntMap<String> raw_map = new TObjectIntHashMap<String>();
    Map<String,Integer> map = TDecorators.wrap( raw_map );

    Map<String, Integer> source = new HashMap<String, Integer>();
    for ( int i = 0; i < element_count; i++ ) {
        source.put( keys[i], vals[i] );
    }

    map.putAll( source );
    assertEquals( source, map );
    assertEquals( control, raw_map );
}
 
开发者ID:palantir,项目名称:trove-3.0.3,代码行数:25,代码来源:TObjectPrimitiveMapDecoratorTest.java

示例11: testClear

import gnu.trove.map.hash.TObjectIntHashMap; //导入依赖的package包/类
public void testClear() {
    int element_count = 20;
    String[] keys = new String[element_count];
    int[] vals = new int[element_count];

    TObjectIntMap<String> raw_map = new TObjectIntHashMap<String>();
    Map<String,Integer> map = TDecorators.wrap( raw_map );
    for ( int i = 0; i < element_count; i++ ) {
        keys[i] = Integer.toString( i + 1 );
        vals[i] = i + 1;
        map.put( keys[i], vals[i] );
    }
    assertEquals( element_count, raw_map.size() );



    map.clear();
    assertTrue( map.isEmpty() );
    assertEquals( 0, map.size() );

    assertNull( map.get( keys[5] ) );
}
 
开发者ID:palantir,项目名称:trove-3.0.3,代码行数:23,代码来源:TObjectPrimitiveMapDecoratorTest.java

示例12: testValues

import gnu.trove.map.hash.TObjectIntHashMap; //导入依赖的package包/类
public void testValues() {
    int element_count = 20;
    String[] keys = new String[element_count];
    Integer[] vals = new Integer[element_count];

    TObjectIntMap<String> raw_map =
            new TObjectIntHashMap<String>( element_count, 0.5f, Integer.MIN_VALUE );
    Map<String,Integer> map = TDecorators.wrap( raw_map );

    for ( int i = 0; i < element_count; i++ ) {
        keys[i] = Integer.toString( i + 1 );
        vals[i] = Integer.valueOf( i + 1 );
        map.put( keys[i], vals[i] );
    }
    assertEquals( element_count, map.size() );

    // No argument
    Collection<Integer> values_collection = map.values();
    assertEquals( element_count, values_collection.size() );
    List<Integer> values_list = new ArrayList<Integer>( values_collection );
    for ( int i = 0; i < element_count; i++ ) {
        assertTrue( values_list.contains( vals[i] ) );
    }
}
 
开发者ID:palantir,项目名称:trove-3.0.3,代码行数:25,代码来源:TObjectPrimitiveMapDecoratorTest.java

示例13: testSerialize

import gnu.trove.map.hash.TObjectIntHashMap; //导入依赖的package包/类
@SuppressWarnings({"unchecked"})
public void testSerialize() throws Exception {
    Integer[] vals = {1138, 42, 86, 99, 101, 727, 117};
    String[] keys = new String[vals.length];

    TObjectIntMap<String> raw_map = new TObjectIntHashMap<String>();
    Map<String,Integer> map = TDecorators.wrap( raw_map );

    for ( int i = 0; i < keys.length; i++ ) {
        keys[i] = Integer.toString( vals[i] * 2 );
        map.put( keys[i], vals[i] );
    }

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    ObjectOutputStream oos = new ObjectOutputStream( baos );
    oos.writeObject( map );

    ByteArrayInputStream bias = new ByteArrayInputStream( baos.toByteArray() );
    ObjectInputStream ois = new ObjectInputStream( bias );

    Map<String,Integer> deserialized = (  Map<String,Integer> ) ois.readObject();

    assertEquals( map, deserialized );
}
 
开发者ID:palantir,项目名称:trove-3.0.3,代码行数:25,代码来源:TObjectPrimitiveMapDecoratorTest.java

示例14: diagnostics

import gnu.trove.map.hash.TObjectIntHashMap; //导入依赖的package包/类
@SubscribeEvent(priority = EventPriority.LOW)
public void diagnostics(final DiagnosticEvent.Gather event) {
	final TObjectIntHashMap<String> counts = new TObjectIntHashMap<String>();

	final Iterator<Entry<String, ISound>> iterator = this.playingSounds.entrySet().iterator();
	while (iterator.hasNext()) {
		Entry<String, ISound> entry = iterator.next();
		ISound isound = entry.getValue();
		counts.adjustOrPutValue(isound.getSound().getSoundLocation().toString(), 1, 1);
	}

	final ArrayList<String> results = new ArrayList<String>();
	final TObjectIntIterator<String> itr = counts.iterator();
	while (itr.hasNext()) {
		itr.advance();
		results.add(String.format(TextFormatting.GOLD + "%s: %d", itr.key(), itr.value()));
	}
	Collections.sort(results);
	event.output.addAll(results);

}
 
开发者ID:OreCruncher,项目名称:DynamicSurroundings,代码行数:22,代码来源:SoundManagerReplacement.java

示例15: postprocessQuery

import gnu.trove.map.hash.TObjectIntHashMap; //导入依赖的package包/类
/**
 * This method represents the last step that's executed when processing a query. A list of partial-results (DistanceElements) returned by
 * the lookup stage is processed based on some internal method and finally converted to a list of ScoreElements. The filtered list of
 * ScoreElements is returned by the feature module during retrieval.
 *
 * @param partialResults List of partial results returned by the lookup stage.
 * @param qc             A ReadableQueryConfig object that contains query-related configuration parameters.
 * @return List of final results. Is supposed to be de-duplicated and the number of items should not exceed the number of items per module.
 */
@Override
protected List<ScoreElement> postprocessQuery(List<SegmentDistanceElement> partialResults, ReadableQueryConfig qc) {
     /* Prepare helper data-structures. */
    final List<ScoreElement> results = new ArrayList<>();
    final TObjectIntHashMap<String> scoreMap = new TObjectIntHashMap<>();

     /* Set QueryConfig and extract correspondence function. */
    qc = this.setQueryConfig(qc);
    final CorrespondenceFunction correspondence = qc.getCorrespondenceFunction().orElse(this.linearCorrespondence);
    for (DistanceElement hit : partialResults) {
        if (hit.getDistance() < this.distanceThreshold) {
            scoreMap.adjustOrPutValue(hit.getId(), 1, scoreMap.get(hit.getId())/2);
        }
    }

    /* Prepare final result-set. */
    scoreMap.forEachEntry((key, value) -> results.add(new SegmentScoreElement(key, 1.0 - 1.0/value)));
    ScoreElement.filterMaximumScores(results.stream());
    return results;
}
 
开发者ID:vitrivr,项目名称:cineast,代码行数:30,代码来源:MFCCShingle.java


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