本文整理汇总了Java中vnreal.network.virtual.VirtualLink.get方法的典型用法代码示例。如果您正苦于以下问题:Java VirtualLink.get方法的具体用法?Java VirtualLink.get怎么用?Java VirtualLink.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vnreal.network.virtual.VirtualLink
的用法示例。
在下文中一共展示了VirtualLink.get方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: cost
import vnreal.network.virtual.VirtualLink; //导入方法依赖的package包/类
public static double cost(VirtualNetwork virtualNetwork) {
double nodeCost = 0;
for (VirtualNode virtualNode : virtualNetwork.getVertices()) {
for (CpuDemand cpuDemand : virtualNode.get(CpuDemand.class)) {
nodeCost += cpuDemand.getDemandedCycles() * cpuDemand.getMappings().size();
}
}
double linkCost = 0;
for (VirtualLink virtualLink : virtualNetwork.getEdges()) {
for (BandwidthDemand bandwidthDemand : virtualLink.get(BandwidthDemand.class)) {
linkCost += bandwidthDemand.getDemandedBandwidth() * bandwidthDemand.getMappings().size();
}
}
return nodeCost + linkCost;
}
示例2: revenue
import vnreal.network.virtual.VirtualLink; //导入方法依赖的package包/类
public static double revenue(VirtualNetwork virtualNetwork) {
double nodeRevenue = 0;
for (VirtualNode virtualNode : virtualNetwork.getVertices()) {
for (CpuDemand cpuDemand : virtualNode.get(CpuDemand.class)) {
nodeRevenue += cpuDemand.getDemandedCycles();
}
}
double linkRevenue = 0;
for (VirtualLink virtualLink : virtualNetwork.getEdges()) {
for (BandwidthDemand bandwidthDemand : virtualLink.get(BandwidthDemand.class)) {
linkRevenue += bandwidthDemand.getDemandedBandwidth();
}
}
return nodeRevenue + linkRevenue;
}
示例3: calculate
import vnreal.network.virtual.VirtualLink; //导入方法依赖的package包/类
@Override
public double calculate(NetworkStack stack) {
double totalBW = 0;
for (VirtualNetwork net : stack.getVirtuals()) {
for (VirtualLink link : net.getEdges()) {
BandwidthDemand dem = (BandwidthDemand) link.get(BandwidthDemand.class);
if (dem != null) {
totalBW += dem.getDemandedBandwidth();
}
}
}
return totalBW;
}
示例4: mapLinks
import vnreal.network.virtual.VirtualLink; //导入方法依赖的package包/类
/**
* mapping of links
*/
boolean mapLinks(VirtualNetwork vNetwork, SubstrateNetwork sNetwork,
NodeLinkMapping result) {
for (VirtualLink vl : vNetwork.getEdges()) {
Pair<VirtualNode> nodes = vNetwork.getEndpoints(vl);
SubstrateNode from = result.getSubstrateNode(nodes.getFirst());
SubstrateNode to = result.getSubstrateNode(nodes.getSecond());
if (from.getId() == to.getId()) {
continue;
}
SubstrateLinkStressTransformer transformer = new SubstrateLinkStressTransformer(
this, sNetwork, vl.get(), biggestLinkStress, delta_L);
DistanceEntry distance = getDistance(sNetwork, from, to,
transformer);
assert (distance == null || Utils.fulfills(distance.path, vl.get()));
if (distance == null) {
return false;
}
result.add(vl, distance.path);
demandedResources.addAll(Utils.occupyPathResources(vl,
distance.path, sNetwork));
SubstrateNode currentNode = from;
for (SubstrateLink sl : distance.path) {
double stress = getStressLevel(sNetwork, currentNode, sl);
if (stress > biggestLinkStress) {
biggestLinkStress = stress;
}
currentNode = sNetwork.getOpposite(currentNode, sl);
}
}
return true;
}
示例5: hasLinkMappings
import vnreal.network.virtual.VirtualLink; //导入方法依赖的package包/类
public static boolean hasLinkMappings(VirtualLink vLink) {
for (AbstractDemand dem : vLink.get())
if (!dem.getMappings().isEmpty())
return true;
return false;
}
示例6: getBandwidthDemand
import vnreal.network.virtual.VirtualLink; //导入方法依赖的package包/类
public static BandwidthDemand getBandwidthDemand(VirtualLink vl) {
for (AbstractDemand r : vl.get()) {
if (r instanceof BandwidthDemand) {
return (BandwidthDemand) r;
}
}
return null;
}
示例7: mapLinks
import vnreal.network.virtual.VirtualLink; //导入方法依赖的package包/类
/**
* mapping of links
*/
boolean mapLinks(VirtualNetwork vNetwork, SubstrateNetwork sNetwork,
Mapping result) {
for (VirtualLink vl : vNetwork.getEdges()) {
Pair<VirtualNode> nodes = vNetwork.getEndpoints(vl);
SubstrateNode from = result.getSubstrateNode(nodes.getFirst());
SubstrateNode to = result.getSubstrateNode(nodes.getSecond());
if (from.getId() == to.getId()) {
continue;
}
SubstrateLinkStressTransformer transformer = new SubstrateLinkStressTransformer(
this, sNetwork,
vl.get(), biggestLinkStress,
delta_L);
DistanceEntry distance = getDistance(sNetwork, from, to, transformer);
assert (distance == null || Utils.fulfills(distance.path, vl.get()));
if (distance == null) {
return false;
}
result.add(vl, distance.path);
demandedResources.addAll(Utils.occupyPathResources(vl,
distance.path, sNetwork, useEnergyDemand));
SubstrateNode currentNode = from;
for (SubstrateLink sl : distance.path) {
double stress = getStressLevel(sNetwork, currentNode, sl);
if (stress > biggestLinkStress) {
biggestLinkStress = stress;
}
currentNode = sNetwork.getOpposite(currentNode, sl);
}
}
return true;
}
示例8: addSub
import vnreal.network.virtual.VirtualLink; //导入方法依赖的package包/类
@Override
public void addSub(VirtualLink virtualLink) {
virtualLinks.add(virtualLink);
for (BandwidthDemand demand : virtualLink.get(BandwidthDemand.class)) {
coarsenBandwidthDemand.addDemand(demand);
}
}
示例9: mapLinks
import vnreal.network.virtual.VirtualLink; //导入方法依赖的package包/类
/**
* mapping of links
*/
boolean mapLinks(VirtualNetwork vNetwork, SubstrateNetwork sNetwork,
Mapping result) {
for (VirtualLink vl : vNetwork.getEdges()) {
Pair<VirtualNode> nodes = vNetwork.getEndpoints(vl);
SubstrateNode from = result.getSubstrateNode(nodes.getFirst());
SubstrateNode to = result.getSubstrateNode(nodes.getSecond());
if (from.getId() == to.getId()) {
continue;
}
SubstrateLinkStressTransformer transformer = new SubstrateLinkStressTransformer(
this, sNetwork, vl.get(), biggestLinkStress, delta_L);
DistanceEntry distance = getDistance(sNetwork, from, to,
transformer);
assert (distance == null || Utils.fulfills(distance.path, vl.get()));
if (distance == null) {
return false;
}
result.add(vl, distance.path);
demandedResources.addAll(Utils.occupyPathResources(vl,
distance.path, sNetwork, useEnergyDemand));
SubstrateNode currentNode = from;
for (SubstrateLink sl : distance.path) {
double stress = getStressLevel(sNetwork, currentNode, sl);
if (stress > biggestLinkStress) {
biggestLinkStress = stress;
}
currentNode = sNetwork.getOpposite(currentNode, sl);
}
}
return true;
}