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


Java TIntObjectHashMap类代码示例

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


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

示例1: addPartition

import gnu.trove.map.hash.TIntObjectHashMap; //导入依赖的package包/类
public void addPartition(EquivalenceManagedPartition partition) {
	if (!this.observedPartitions.contains(partition.getIndices()) && !this.containsSimilarPartition(partition)) {
		this.observedPartitions.add(partition.getIndices());
		long hashNumber = partition.getHashNumber();
		System.out.println(String.format("Partition[%s]\t%d\tSize: %d", partition.getIndices(), hashNumber, partition.size()));
		partitionHashes.putIfAbsent(hashNumber, new TIntObjectHashMap<THashSet<EquivalenceManagedPartition>>());
		partitionHashes.get(hashNumber).putIfAbsent(partition.size(), new THashSet<EquivalenceManagedPartition>());
		THashSet<EquivalenceManagedPartition> partitionGroup = partitionHashes.get(hashNumber).get(partition.size());

		if (partitionGroup.isEmpty()) {
			partitionGroup.add(partition);
		} else {
			// then there is at least one element in the partitionGroup
			checkPossibleEquivalences(partitionGroup, partition);
		}
	}
}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:18,代码来源:PartitionEquivalences.java

示例2: CodeGenTypes

import gnu.trove.map.hash.TIntObjectHashMap; //导入依赖的package包/类
public CodeGenTypes(HIRModuleGenerator moduleBuilder, TargetData td)
{
    builder = moduleBuilder;
    typeCaches = new HashMap<>();
    recordBeingLaidOut = new HashSet<>();
    functionBeingProcessed = new HashSet<>();
    deferredRecords = new LinkedList<>();
    recordDeclTypes = new HashMap<>();
    cgRecordLayout = new HashMap<>();
    fieldInfo = new HashMap<>();
    bitfields = new HashMap<>();
    context = moduleBuilder.getASTContext();
    target = context.target;
    theModule = moduleBuilder.getModule();
    targetData = td;
    pointersToResolve = new LinkedList<>();
    tagDeclTypes = new HashMap<>();
    functionTypes = new HashMap<>();
    functionInfos = new TIntObjectHashMap<>();
}
 
开发者ID:JianpingZeng,项目名称:xcc,代码行数:21,代码来源:CodeGenTypes.java

示例3: register

import gnu.trove.map.hash.TIntObjectHashMap; //导入依赖的package包/类
public void register(Item item, int meta, ModelResourceLocation location)
{
    TIntObjectHashMap<ModelResourceLocation> locs = locations.get(item);
    TIntObjectHashMap<IBakedModel>           mods = models.get(item);
    if (locs == null)
    {
        locs = new TIntObjectHashMap<ModelResourceLocation>();
        locations.put(item, locs);
    }
    if (mods == null)
    {
        mods = new TIntObjectHashMap<IBakedModel>();
        models.put(item, mods);
    }
    locs.put(meta, location);
    mods.put(meta, getModelManager().getModel(location));
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:18,代码来源:ItemModelMesherForge.java

示例4: createMesh

import gnu.trove.map.hash.TIntObjectHashMap; //导入依赖的package包/类
public void createMesh(List<Mesher> meshers, JmeResourceManager resourceManager) {
	Realm realm = chunk.getRealm();
	
	TIntObjectMap<Mesh> meshes = new TIntObjectHashMap<>();
	
	for (Mesher mesher : meshers) {
		meshes.putAll(mesher.buildMeshes(chunk));
	}
	
	geometries.clear();
	
	for (int key : meshes.keys()) {
		Block block = realm.getCosmos().getBlocks().get(key);
		
		Geometry geometry = new Geometry(chunk.toString() + ":" + block.getName(), meshes.get(key));
		geometry.setMaterial(resourceManager.getMaterial(block));
		geometry.setQueueBucket(Bucket.Transparent);
		
		geometries.add(geometry);
	}
}
 
开发者ID:quadracoatl,项目名称:quadracoatl,代码行数:22,代码来源:ChunkSpatial.java

示例5: testGet

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

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

    assertEquals(vals[10], map.get(Integer.valueOf(keys[10])));
    assertNull(map.get(Integer.valueOf(1138)));

    Integer key = Integer.valueOf(1138);
    map.put(key, null);
    assertTrue(map.containsKey(key));
    assertNull(map.get(key));

    Long long_key = Long.valueOf(1138);
    //noinspection SuspiciousMethodCalls
    assertNull(map.get(long_key));
}
 
开发者ID:palantir,项目名称:trove-3.0.3,代码行数:26,代码来源:TPrimitiveObjectMapDecoratorTest.java

示例6: testContainsKey

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

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

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

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

示例7: testContainsValue

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

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

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

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

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

示例8: testPutAllMap

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

    TIntObjectMap<String> raw_control = new TIntObjectHashMap<String>();
    for (int i = 0; i < element_count; i++) {
        keys[i] = i + 1;
        vals[i] = Integer.toString(i + 1);
        raw_control.put(keys[i], vals[i]);
    }
    Map<Integer, String> control = TDecorators.wrap(raw_control);

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

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

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

示例9: testPutAll

import gnu.trove.map.hash.TIntObjectHashMap; //导入依赖的package包/类
public void testPutAll() throws Exception {
    TIntObjectMap<String> raw_t = new TIntObjectHashMap<String>();
    Map<Integer, String> t = TDecorators.wrap(raw_t);
    TIntObjectMap<String> raw_m = new TIntObjectHashMap<String>();
    Map<Integer, String> m = TDecorators.wrap(raw_m);
    m.put(2, "one");
    m.put(4, "two");
    m.put(6, "three");

    t.put(5, "four");
    assertEquals(1, t.size());

    t.putAll(m);
    assertEquals(4, t.size());
    assertEquals("two", t.get(4));
}
 
开发者ID:palantir,项目名称:trove-3.0.3,代码行数:17,代码来源:TPrimitiveObjectMapDecoratorTest.java

示例10: testClear

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

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

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

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

示例11: testSerialize

import gnu.trove.map.hash.TIntObjectHashMap; //导入依赖的package包/类
@SuppressWarnings({"unchecked"})
public void testSerialize() throws Exception {
    int element_count = 20;
    int[] keys = new int[element_count];
    String[] vals = new String[element_count];

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

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

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

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

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

示例12: init

import gnu.trove.map.hash.TIntObjectHashMap; //导入依赖的package包/类
public void init(){
    handlerMap = new HashMap<>();
    TIntObjectHashMap<Class<?>> netEventHandlerClassMap = ServiceHelper.getNetEventListenerHandlerClassMap();
    netEventHandlerClassMap.forEachEntry(new TIntObjectProcedure<Class<?>>() {
        @Override
        public boolean execute(int i, Class<?> aClass) {
            handlerMap.put(i, (NetEventListenerHandler) BeanHelper.getServiceBean(aClass));
            return true;
        }
    });

    selfAdd = Util.getHostAddress()+":"+Server.getEngineConfigure().getNetEventPort();


    monitorService = BeanHelper.getServiceBean(MonitorService.class);
    eventService = BeanHelper.getServiceBean(EventService.class);
    monitorService.addStartCondition(SysConstantDefine.NetEventServiceStart,
            "wait for netEvent start and connect mainServer");
}
 
开发者ID:xuerong,项目名称:MMServerEngine,代码行数:20,代码来源:NetEventService.java

示例13: DynamicGrid

import gnu.trove.map.hash.TIntObjectHashMap; //导入依赖的package包/类
public DynamicGrid(T defaultElement, T[][] data){
  this(defaultElement);
  for(int x = 0; x < data.length; ++x){
    T[] arr = data[x];
    TIntObjectHashMap<T> map = new TIntObjectHashMap<>();
    for(int y = 0; y < arr.length; ++y){
      T element = arr[y];
      if(element != null){
        map.put(y, element);
      }
    }
    map.compact();
    grid.put(x, map);
  }
  grid.compact();
}
 
开发者ID:vitrivr,项目名称:cineast,代码行数:17,代码来源:DynamicGrid.java

示例14: transform

import gnu.trove.map.hash.TIntObjectHashMap; //导入依赖的package包/类
public static byte[] transform(WatchedEntity entity, byte[] data) throws IOException {
    if (entity == null) {
        return data;
    }
    TIntObjectMap<DataWatcherObject> objects = DataWatcherSerializer.decodeData(data);
    TIntObjectMap<DataWatcherObject> newobjects = new TIntObjectHashMap<DataWatcherObject>();
    //copy entity
    moveDWData(objects, newobjects, 0, 0); //flags
    moveDWData(objects, newobjects, 1, 1); //air
    moveDWData(objects, newobjects, 2, 2); //nametag
    moveDWData(objects, newobjects, 3, 3); //nametagvisible
    //copy specific types
    for (RemappingEntry entry : entity.getType().getRemaps()) {
        moveDWData(objects, newobjects, entry.getFrom(), entry.getTo());
    }
    return DataWatcherSerializer.encodeData(newobjects);
}
 
开发者ID:MCCarbon,项目名称:Carbon-2,代码行数:18,代码来源:DataWatcherTransformer.java

示例15: setFeatureExtractor

import gnu.trove.map.hash.TIntObjectHashMap; //导入依赖的package包/类
public void setFeatureExtractor(TrendDetectorFeatureExtractor fe) {
	this.extractor = fe;
	final MersenneTwister rng = new MersenneTwister();

	final DoubleGaussianFactory gauss = new DoubleGaussianFactory(fe.nDimensions(), rng, w);
	final HashFunctionFactory<double[]> factory = new HashFunctionFactory<double[]>() {
		@Override
		public HashFunction<double[]> create() {
			return new LSBModifier<double[]>(gauss.create());
		}
	};

	sketcher = new IntLSHSketcher<double[]>(factory, nbits);
	database = new ArrayList<TIntObjectHashMap<Set<WriteableImageOutput>>>(
			sketcher.arrayLength());

	for (int i = 0; i < sketcher.arrayLength(); i++)
		database.add(new TIntObjectHashMap<Set<WriteableImageOutput>>());

}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:21,代码来源:TrendDetector.java


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