本文整理汇总了Java中net.floodlightcontroller.routing.BroadcastTree.getCost方法的典型用法代码示例。如果您正苦于以下问题:Java BroadcastTree.getCost方法的具体用法?Java BroadcastTree.getCost怎么用?Java BroadcastTree.getCost使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.floodlightcontroller.routing.BroadcastTree
的用法示例。
在下文中一共展示了BroadcastTree.getCost方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPath
import net.floodlightcontroller.routing.BroadcastTree; //导入方法依赖的package包/类
protected static MetricEdge getPath(Long src, Long dst){
BroadcastTree tree = destinationRootedTrees.get(dst);
if(src.equals(dst)){
return null;
}
ArrayList<Link> path = new ArrayList<Link>();
int cost = tree.getCost(src);
Long tmpsrc = src;
do{
Link link = tree.getTreeLink(tmpsrc);
if(link == null) break;
// cost += tree.getCost(src);
tmpsrc = link.getDst();
path.add(link);
}while(true);
MetricEdge metricEdge = new MetricEdge(src, dst, path, cost );
return metricEdge;
}
示例2: getDist
import net.floodlightcontroller.routing.BroadcastTree; //导入方法依赖的package包/类
private Integer getDist(Long switchid, Long rootid, HashMap<Long, Integer> metric, BroadcastTree tree){
if(switchid == null || switchid.equals(rootid)){
return 0;
}
if(metric.containsKey(switchid) == true){
return metric.get(switchid);
}else{
Link link = tree.getTreeLink(switchid);
Long neighbour = link.getDst();
int cost = tree.getCost(switchid);
return cost + getDist(neighbour, rootid, metric, tree);
}
}
示例3: MST__Core
import net.floodlightcontroller.routing.BroadcastTree; //导入方法依赖的package包/类
private Graph MST__Core(Graph graph, Map<Long, BroadcastTree> drtree) {
// TODO Auto-generated method stub
Graph retgraph = new Graph();
ArrayList<Long> treeNodes = new ArrayList<Long>();
ArrayList<Long> nonTreeNodes = new ArrayList<Long>(graph.neighbourmap.keySet());
if(nonTreeNodes.isEmpty() == false)
treeNodes.add(nonTreeNodes.remove(0));
while(nonTreeNodes.isEmpty() == false){
int min = Integer.MAX_VALUE;
Long chosenTreeNode = null;
Long chosenNonTreeNode = null;
for(Long treenode: treeNodes){
BroadcastTree btree = drtree.get(treenode);
for(Long nontreenode: nonTreeNodes){
if(btree.getCost(nontreenode) < min){
min = btree.getCost(nontreenode);
chosenTreeNode = treenode;
chosenNonTreeNode = nontreenode;
}
}
}
treeNodes.add(chosenNonTreeNode);
nonTreeNodes.remove(chosenNonTreeNode);
retgraph.addedge(chosenTreeNode, chosenNonTreeNode);
retgraph.addedge(chosenNonTreeNode, chosenTreeNode);
}
return retgraph;
}
示例4: getCost
import net.floodlightcontroller.routing.BroadcastTree; //导入方法依赖的package包/类
protected int getCost(DatapathId srcId, DatapathId dstId) {
BroadcastTree bt = destinationRootedTrees.get(dstId);
if (bt == null) return -1;
return bt.getCost(srcId);
}
示例5: getCost
import net.floodlightcontroller.routing.BroadcastTree; //导入方法依赖的package包/类
protected int getCost(DatapathId srcId, DatapathId dstId) {
BroadcastTree bt = destinationRootedTrees.get(dstId);
if (bt == null) return -1;
return (bt.getCost(srcId));
}
示例6: getCost
import net.floodlightcontroller.routing.BroadcastTree; //导入方法依赖的package包/类
protected int getCost(long srcId, long dstId) {
BroadcastTree bt = destinationRootedTrees.get(dstId);
if (bt == null) return -1;
return (bt.getCost(srcId));
}