當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。