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


Java TObjectFloatHashMap类代码示例

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


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

示例1: getBiomeSounds

import gnu.trove.map.hash.TObjectFloatHashMap; //导入依赖的package包/类
private static void getBiomeSounds(@Nonnull final TObjectFloatHashMap<SoundEffect> result) {
	// Need to collect sounds from all the applicable biomes
	// along with their weights.
	final TObjectIntIterator<BiomeInfo> info = AreaSurveyHandler.getBiomes().iterator();
	while (info.hasNext()) {
		info.advance();
		final List<SoundEffect> bs = new ArrayList<SoundEffect>();
		info.key().findSoundMatches(bs);
		for (final SoundEffect sound : bs) {
			final int w = info.value();
			result.adjustOrPutValue(sound, w, w);
		}
	}

	// Scale the volumes in the resulting list based on the weights
	final int area = AreaSurveyHandler.getBiomeArea();
	final TObjectFloatIterator<SoundEffect> itr = result.iterator();
	while (itr.hasNext()) {
		itr.advance();
		final float scale = 0.1F + 0.9F * ((float) itr.value() / (float) area);
		itr.setValue(scale);
	}
}
 
开发者ID:OreCruncher,项目名称:DynamicSurroundings,代码行数:24,代码来源:AreaSoundEffectHandler.java

示例2: analyseImage

import gnu.trove.map.hash.TObjectFloatHashMap; //导入依赖的package包/类
@Override
public void analyseImage(MBFImage image) {
	final int width = image.getWidth();
	final int height = image.getHeight();

	image.analyseWith(saliencyGenerator);
	final TObjectFloatHashMap<ConnectedComponent> componentMap = saliencyGenerator.getSaliencyComponents();

	asSum = 0;
	aseSum = 0;
	componentMap.forEachEntry(new TObjectFloatProcedure<ConnectedComponent>() {
		@Override
		public boolean execute(ConnectedComponent c, float s) {
			final double as = c.calculateArea() * s;

			final double D = closestDistance(c, width, height);

			asSum += as;
			aseSum += as * Math.exp(-(D * D) / (2 * SIGMA));

			return true;
		}
	});
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:25,代码来源:RuleOfThirds.java

示例3: 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

示例4: 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

示例5: analyseImage

import gnu.trove.map.hash.TObjectFloatHashMap; //导入依赖的package包/类
@Override
public void analyseImage(MBFImage image) {
	image.analyseWith(saliencyGenerator);
	final TObjectFloatHashMap<ConnectedComponent> componentMap = saliencyGenerator.getSaliencyComponents();

	final float max = ArrayUtils.maxValue(componentMap.values());

	final FImage map = new FImage(image.getWidth(), image.getHeight());
	final float thresh = max * alpha;
	final BoundingBoxRenderer<Float> renderer = new BoundingBoxRenderer<Float>(map, 1F, true);

	componentMap.forEachEntry(new TObjectFloatProcedure<ConnectedComponent>() {
		@Override
		public boolean execute(ConnectedComponent cc, float sal) {
			if (sal >= thresh) { // note that this is reversed from the
				// paper, which doesn't seem to make
				// sense.
				renderer.process(cc);
			}

			return true;
		}
	});

	roiProportion = 0;
	for (int y = 0; y < map.height; y++)
		for (int x = 0; x < map.width; x++)
			roiProportion += map.pixels[y][x];

	roiProportion /= (map.width * map.height); // smaller simplicity means
	// smaller ROI
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:33,代码来源:ROIProportion.java

示例6: 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

示例7: 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

示例8: AutoDeltaObjectFloatMap

import gnu.trove.map.hash.TObjectFloatHashMap; //导入依赖的package包/类
public AutoDeltaObjectFloatMap(Function<ByteBuffer, K> keyCreator) {
    this.changes = new ArrayList<>(5);
    this.container = new TObjectFloatHashMap<>();
    this.baselineCommandCount = 0;
    this.keyCreator = keyCreator;
}
 
开发者ID:bacta,项目名称:pre-cu,代码行数:7,代码来源:AutoDeltaObjectFloatMap.java

示例9: AutoDeltaStringFloatMap

import gnu.trove.map.hash.TObjectFloatHashMap; //导入依赖的package包/类
public AutoDeltaStringFloatMap() {
    this.changes = new ArrayList<>(5);
    this.container = new TObjectFloatHashMap<>();
    this.baselineCommandCount = 0;
}
 
开发者ID:bacta,项目名称:pre-cu,代码行数:6,代码来源:AutoDeltaStringFloatMap.java

示例10: HateList

import gnu.trove.map.hash.TObjectFloatHashMap; //导入依赖的package包/类
public HateList() {

        this.hateList = new TObjectFloatHashMap<>();
        this.recentHateList = new TLongHashSet();
    }
 
开发者ID:bacta,项目名称:pre-cu,代码行数:6,代码来源:HateList.java

示例11: cleanup

import gnu.trove.map.hash.TObjectFloatHashMap; //导入依赖的package包/类
public void cleanup() {
    inputItems = new TObjectFloatHashMap<String>();
    inputSignals = new HashMap<String, Map<String, Integer>>();
    outputItems = bf.newDefaultBag();
}
 
开发者ID:mortardata,项目名称:gitrec,代码行数:6,代码来源:FilterItemItemLinksDetailed.java

示例12: cleanup

import gnu.trove.map.hash.TObjectFloatHashMap; //导入依赖的package包/类
public void cleanup() {
    inputItems = new TObjectFloatHashMap<String>();
    outputItems = bf.newDefaultBag();
}
 
开发者ID:mortardata,项目名称:gitrec,代码行数:5,代码来源:FilterItemItemLinks.java

示例13: getSaliencyComponents

import gnu.trove.map.hash.TObjectFloatHashMap; //导入依赖的package包/类
/**
 * Get a map of component->saliency for all the components in
 * the image
 * @return component->saliency map
 */
public TObjectFloatHashMap<ConnectedComponent> getSaliencyComponents() {
	return componentMap;
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:9,代码来源:YehSaliency.java


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