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


Java TObjectFloatHashMap.put方法代码示例

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


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

示例1: queueAmbientSounds

import gnu.trove.map.hash.TObjectFloatHashMap; //导入方法依赖的package包/类
public void queueAmbientSounds(@Nonnull final TObjectFloatHashMap<SoundEffect> sounds) {
	// Iterate through the existing emitters:
	// * If done, remove
	// * If not in the incoming list, fade
	// * If it does exist, update volume throttle and unfade if needed
	final Iterator<Entry<SoundEffect, Emitter>> itr = this.emitters.entrySet().iterator();
	while (itr.hasNext()) {
		final Entry<SoundEffect, Emitter> e = itr.next();
		final Emitter emitter = e.getValue();
		if (emitter.isDonePlaying()) {
			DSurround.log().debug("Removing emitter: %s", emitter.toString());
			itr.remove();
		} else if (sounds.contains(e.getKey())) {
			emitter.setVolumeThrottle(sounds.get(e.getKey()));
			if (emitter.isFading())
				emitter.unfade();
			// Set to 0 so that the "new sound" logic below
			// will ignore. Cheaper than removing the object
			// from the collection.
			sounds.put(e.getKey(), 0F);
		} else {
			if (!emitter.isFading())
				emitter.fade();
		}
	}

	// Any sounds left in the list are new and need
	// an emitter created.
	final TObjectFloatIterator<SoundEffect> newSounds = sounds.iterator();
	while (newSounds.hasNext()) {
		newSounds.advance();
		if (newSounds.value() > 0) {
			final SoundEffect effect = newSounds.key();
			this.emitters.put(effect, new PlayerEmitter(effect));
		}
	}
}
 
开发者ID:OreCruncher,项目名称:DynamicSurroundings,代码行数:38,代码来源:SoundEffectHandler.java

示例2: getSimilar

import gnu.trove.map.hash.TObjectFloatHashMap; //导入方法依赖的package包/类
@Override
public List<ScoreElement> getSimilar(SegmentContainer sc, ReadableQueryConfig qc) {

  TObjectFloatHashMap<String> tagScores = new TObjectFloatHashMap<>();
  
  for(Tag tag : sc.getTags()){
    if(!tag.hasId() && !tag.hasName()){
      LOGGER.info("skipping empty tag");
      continue;
    }
    
    if(!tag.hasId()){
      List<Tag> tags = tagHandler.getTagsByName(tag.getName());
      
      for(Tag t : tags){
        tagScores.put(t.getId(), 1f);
      }
      
    }else{
      tagScores.put(tag.getId(), 1f);
    }
    
  }
  
  return processTagScores(tagScores);
  
}
 
开发者ID:vitrivr,项目名称:cineast,代码行数:28,代码来源:Tags.java

示例3: segmentGraph

import gnu.trove.map.hash.TObjectFloatHashMap; //导入方法依赖的package包/类
protected DisjointSetForest<Pixel> segmentGraph(int numVertices, List<SimpleWeightedEdge<Pixel>> edges) { 
	// sort edges by weight
	Collections.sort(edges, SimpleWeightedEdge.ASCENDING_COMPARATOR);

	// make a disjoint-set forest
	DisjointSetForest<Pixel> u = new DisjointSetForest<Pixel>(numVertices);

	for (SimpleWeightedEdge<Pixel> edge : edges) {
		u.add(edge.from);
		u.add(edge.to);
	}

	// init thresholds
	TObjectFloatHashMap<Pixel> threshold = new TObjectFloatHashMap<Pixel>();
	for (Pixel p : u) {
		threshold.put(p, k);
	}

	// for each edge, in non-decreasing weight order...
	for (int i = 0; i < edges.size(); i++) {
		SimpleWeightedEdge<Pixel> pedge = edges.get(i);

		// components connected by this edge
		Pixel a = u.find(pedge.from);
		Pixel b = u.find(pedge.to);
		if (a != b) {
			if ((pedge.weight <= threshold.get(a)) && (pedge.weight <= threshold.get(b))) {
				a = u.union(a, b);
				threshold.put(a, pedge.weight + (k / u.size(a)));
			}
		}
	}

	return u;
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:36,代码来源:FelzenszwalbHuttenlocherSegmenter.java

示例4: loadTStringFloatMap

import gnu.trove.map.hash.TObjectFloatHashMap; //导入方法依赖的package包/类
public static TObjectFloatHashMap<String> loadTStringFloatMap(String path) throws IOException {
	TObjectFloatHashMap<String> dict = new TObjectFloatHashMap<String>();
	BufferedReader 	bfr = new BufferedReader(new InputStreamReader(new FileInputStream(path), "utf8"));

	String line = null;
	while ((line = bfr.readLine()) != null) {
		if (line.length() == 0)
			continue;
		int idx = line.lastIndexOf("\t");
		dict.put(line.substring(0, idx), Float.parseFloat(line.substring(idx + 1)));
	}
	bfr.close();
	return dict;
}
 
开发者ID:FudanNLP,项目名称:fnlp,代码行数:15,代码来源:MyCollection.java


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