本文整理汇总了Java中com.davidsoergel.dsutils.collections.MutableWeightedSet类的典型用法代码示例。如果您正苦于以下问题:Java MutableWeightedSet类的具体用法?Java MutableWeightedSet怎么用?Java MutableWeightedSet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MutableWeightedSet类属于com.davidsoergel.dsutils.collections包,在下文中一共展示了MutableWeightedSet类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: distributeInternalWeightsToLeaves
import com.davidsoergel.dsutils.collections.MutableWeightedSet; //导入依赖的package包/类
public Map<T, Double> distributeInternalWeightsToLeaves(Map<T, Double> taxIdToWeightMap) throws NoSuchNodeException
{
MutableWeightedSet<T> result = new ConcurrentHashWeightedSet<T>();
for (Map.Entry<T, Double> entry : taxIdToWeightMap.entrySet())
{
T id = entry.getKey();
Double weight = entry.getValue();
try
{
PhylogenyNode<T> n = getNode(id);
distributeWeight(n, weight, result);
}
catch (NoSuchNodeException e)
{
// this can only happen if we already issued a warning about "node not found"
logger.warn("Requested member weight dropped: " + id + " " + weight);
}
}
return result.getItemNormalizedMap();
}
示例2: distributeWeight
import com.davidsoergel.dsutils.collections.MutableWeightedSet; //导入依赖的package包/类
private void distributeWeight(PhylogenyNode<T> n, Double weight, MutableWeightedSet<T> result)
throws NoSuchNodeException
{
if (n.isLeaf())
{
result.add(n.getPayload(), weight, 1);
//result.incrementItems();
}
else
{
List<? extends PhylogenyNode<T>> children = n.getChildren();
double childWeight = weight / children.size();
for (PhylogenyNode<T> child : children)
{
distributeWeight(child, childWeight, result);
}
}
}
示例3: getMutableWeightedLabels
import com.davidsoergel.dsutils.collections.MutableWeightedSet; //导入依赖的package包/类
@NotNull
public MutableWeightedSet<String> getMutableWeightedLabels()
{
return labels.getMutableWeightedLabels();
}