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


Java SubstrateNetwork.getEdges方法代码示例

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


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

示例1: generateRandomBandwidthResources

import vnreal.network.substrate.SubstrateNetwork; //导入方法依赖的package包/类
public static void generateRandomBandwidthResources(
		SubstrateNetwork sNetwork, int minResourceBandwidth,
		int maxResourceBandwidth, Random random,
		boolean useCommonConstraints) {

	for (SubstrateLink l : sNetwork.getEdges()) {
		int value = Utils.rnd(minResourceBandwidth, maxResourceBandwidth, random);
		
		if (useCommonConstraints) {
			CommonResource r = new CommonResource(value, l);
			l.add(r);
		} else {
			BandwidthResource bw = new BandwidthResource(l);
			bw.setBandwidth((double) value);
			l.add(bw);
		}
	}
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:19,代码来源:RandomResourceGenerator.java

示例2: calculate

import vnreal.network.substrate.SubstrateNetwork; //导入方法依赖的package包/类
public double calculate(NetworkStack stack) {
	double sum = 0.0;
	int i = 0;
	SubstrateNetwork sNetwork = stack.getSubstrate();

	for (SubstrateLink sl : sNetwork.getEdges()) {
		for (AbstractResource res : sl.get()) {
			for (Mapping m : res.getMappings()) {
				AbstractDemand dem = m.getDemand();

				if (dem instanceof BandwidthDemand) {
					sum += ((BandwidthDemand) dem).getDemandedBandwidth();
					i++;
				}
			}
		}
	}

	return (i == 0 ? 0.0 : (sum / (double) i));
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:21,代码来源:LinkUtilization.java

示例3: calculate

import vnreal.network.substrate.SubstrateNetwork; //导入方法依赖的package包/类
public double calculate(NetworkStack stack) {
	SubstrateNetwork sNetwork = stack.getSubstrate();

	int sumLinkStress = 0;
	int counter = 0;
	for (SubstrateLink sl : sNetwork.getEdges()) {
		int stress = Utils.getStressLevel(sl);
		sumLinkStress += stress;
		if (stress != 0) {
			++counter;
		}
	}
	
	if (counter == 0)
		return Double.NaN;

	return (sumLinkStress / (double) counter);
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:19,代码来源:AvActiveLinkStress.java

示例4: calcLinksRes

import vnreal.network.substrate.SubstrateNetwork; //导入方法依赖的package包/类
/**
 * 
 * @param sn
 *            Substrate node
 * @return The available resources of the node sn
 */
private double calcLinksRes(SubstrateNetwork sNet, SubstrateNode sn) {
	SubstrateNode srcSnode = null;
	double resBW = 0;
	double total_resBW = 0;

	for (SubstrateLink sl : sNet.getEdges()) {
		srcSnode = sNet.getSource(sl);
		// If the processing SubstrateNode is equals to the source of a
		// SubstrateLink then add the link
		if (sn.equals(srcSnode)) {
			for (AbstractResource res : sl) {
				if (res instanceof BandwidthResource) {
					resBW = ((BandwidthResource) res)
							.getAvailableBandwidth();
					total_resBW += resBW;
				}
			}

		}
	}
	return total_resBW;
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:29,代码来源:AvailableResourcesNodeMapping.java

示例5: removeDuplicateEdges

import vnreal.network.substrate.SubstrateNetwork; //导入方法依赖的package包/类
void removeDuplicateEdges(LockTree current, Collection<SubstrateLink> orig) {
	if (current.getChildren() != null) {
		for (LockTree c : current.getChildren()) {
			SubstrateNetwork cc = current.getClusterHead().cluster;
			for (SubstrateLink l : new LinkedList<SubstrateLink>(cc.getEdges())) {
				boolean found = false;
				for (SubstrateLink o : orig) {
					if (o.getName().equals(l.getName())) {
						found = true;
						break;
					}
				}
				if (!found) {
					cc.removeEdge(l);
				}
			}
			removeDuplicateEdges(c, orig);
		}
	}
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:21,代码来源:HierarchicalPartitioning.java

示例6: generate

import vnreal.network.substrate.SubstrateNetwork; //导入方法依赖的package包/类
@Override
public List<CostResource> generate(ArrayList<Object> parameters) {
	ArrayList<CostResource> resList = new ArrayList<CostResource>();
	
	NetworkStack ns = (NetworkStack)parameters.get(0);
	Integer minLC = ConversionHelper.paramObjectToInteger(parameters.get(1));
	Integer maxLC = ConversionHelper.paramObjectToInteger(parameters.get(2));
	Long seed = ConversionHelper.paramObjectToLong(parameters.get(3));
	
	Random random = new Random();
	random.setSeed(seed);
	
	SubstrateNetwork sNet = ns.getSubstrate();
	
	for (SubstrateLink l : sNet.getEdges()) {
		CostResource bw = new CostResource(l);
		int value = (int) (minLC + (maxLC
				- minLC + 1)
				* random.nextDouble());
		bw.setCost((double) value);
		l.add(bw);
		resList.add(bw);
	}
	
	return resList;
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:27,代码来源:FixedCostResourceGenerator.java

示例7: generate

import vnreal.network.substrate.SubstrateNetwork; //导入方法依赖的package包/类
@Override
public List<BandwidthResource> generate(ArrayList<Object> parameters) {
	ArrayList<BandwidthResource> resList = new ArrayList<BandwidthResource>();
	
	NetworkStack ns = (NetworkStack)parameters.get(0);
	Integer minBW = ConversionHelper.paramObjectToInteger(parameters.get(1));
	Integer maxBW = ConversionHelper.paramObjectToInteger(parameters.get(2));
	Long seed = ConversionHelper.paramObjectToLong(parameters.get(3)); 
	
	Random random = new Random();
	random.setSeed(seed);
	
	SubstrateNetwork sNet = ns.getSubstrate();
	
	for (SubstrateLink l : sNet.getEdges()) {
		BandwidthResource bw = new BandwidthResource(l);
                       int value = (int) (minBW + random.nextInt(maxBW - minBW + 1));
		bw.setBandwidth((double) value);
		l.add(bw);
		resList.add(bw);
	}
	
	return resList;
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:25,代码来源:FixedBandwidthResourceGenerator.java

示例8: generate

import vnreal.network.substrate.SubstrateNetwork; //导入方法依赖的package包/类
@Override
public List<CostResource> generate(ArrayList<Object> parameters) {
	ArrayList<CostResource> resList = new ArrayList<CostResource>();
	
	NetworkStack ns = (NetworkStack)parameters.get(0);
	Integer minLC = ConversionHelper.paramObjectToInteger(parameters.get(1));
	Integer maxLC = ConversionHelper.paramObjectToInteger(parameters.get(2));
	
	Random random = new Random();
	
	SubstrateNetwork sNet = ns.getSubstrate();
	
	for (SubstrateLink l : sNet.getEdges()) {
		CostResource bw = new CostResource(l);
		int value = (int) (minLC + (maxLC
				- minLC + 1)
				* random.nextDouble());
		bw.setCost((double) value);
		l.add(bw);
		resList.add(bw);
	}
	
	return resList;
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:25,代码来源:RandomCostResourceGenerator.java

示例9: generate

import vnreal.network.substrate.SubstrateNetwork; //导入方法依赖的package包/类
@Override
public List<BandwidthResource> generate(ArrayList<Object> parameters) {
	ArrayList<BandwidthResource> resList = new ArrayList<BandwidthResource>();
	
	Random random = new Random();
	
	NetworkStack ns = (NetworkStack)parameters.get(0);
	Integer minBW = ConversionHelper.paramObjectToInteger(parameters.get(1));
	Integer maxBW = ConversionHelper.paramObjectToInteger(parameters.get(2));
	
	SubstrateNetwork sNet = ns.getSubstrate();
	
	for (SubstrateLink l : sNet.getEdges()) {
		BandwidthResource bw = new BandwidthResource(l);
		int value = (int) (minBW + (maxBW
				- minBW + 1)
				* random.nextDouble());
		bw.setBandwidth((double) value);
		l.add(bw);
		resList.add(bw);
	}
	
	return resList;
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:25,代码来源:RandomBandwidthResourceGenerator.java

示例10: export

import vnreal.network.substrate.SubstrateNetwork; //导入方法依赖的package包/类
/**
 * Export a SubstrateNetwork
 * @param filename The file to write to
 * @param snet The network to export
 * @throws IOException
 */
public void export(String filename, SubstrateNetwork snet) throws IOException {
		
	FileOutputStream outStream = new FileOutputStream(filename);
	BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(outStream));
	
	String firstLine = snet.isDirected() ? "digraph" : "graph";
	String edge = snet.isDirected() ? " -> " : " -- ";
	firstLine += " \"" + snet.getLabel() + "\" {\n";
	bw.write(firstLine);
	
	for (SubstrateNode sn: snet.getVertices()) {
		bw.write("\t" + sn.getId() + ";\n");
	}
	
	for (SubstrateLink sl : snet.getEdges()) {
		SubstrateNode n1 = snet.getSource(sl);
		SubstrateNode n2 = snet.getDest(sl);
		String line = "\t" + n1.getId() + edge + n2.getId() + ";\n";
		bw.write(line);
	}
	
	bw.write("}");
	bw.flush();
	bw.close();
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:32,代码来源:DOTExporter.java

示例11: generateRandomDelayResources

import vnreal.network.substrate.SubstrateNetwork; //导入方法依赖的package包/类
public static void generateRandomDelayResources(SubstrateNetwork sNetwork,
		int minDelayResource, int maxDelayResource, Random random) {

	for (SubstrateLink n : sNetwork.getEdges()) {
		int value = (int) (minDelayResource + (maxDelayResource
				- minDelayResource + 1)
				* random.nextDouble());
		StaticDelayResource res = new StaticDelayResource(n, value);
		n.add(res);
	}
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:12,代码来源:RandomResourceGenerator.java

示例12: generateRandomBandwidthResources

import vnreal.network.substrate.SubstrateNetwork; //导入方法依赖的package包/类
public static void generateRandomBandwidthResources(
		SubstrateNetwork sNetwork,
		Integer[] bandwidthResources,
		Random random) {

	for (SubstrateLink l : sNetwork.getEdges()) {
		BandwidthResource bw = new BandwidthResource(l);
		int pos = Utils.rnd(0, bandwidthResources.length - 1, random);
		int value = bandwidthResources[pos];
		bw.setBandwidth((double) value);
		l.add(bw);
	}
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:14,代码来源:RandomSetResourceGenerator.java

示例13: generateRandomDelayResources

import vnreal.network.substrate.SubstrateNetwork; //导入方法依赖的package包/类
public static void generateRandomDelayResources(SubstrateNetwork network,
		Integer[] DelayResources, Random random) {
	
	for (SubstrateLink l : network.getEdges()) {
		int pos = Utils.rnd(0, DelayResources.length - 1, random);
		int value = DelayResources[pos];
		l.add(new StaticDelayResource(l, value));
	}
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:10,代码来源:RandomSetResourceGenerator.java

示例14: calculate

import vnreal.network.substrate.SubstrateNetwork; //导入方法依赖的package包/类
public double calculate(NetworkStack stack) {
	SubstrateNetwork sNetwork = stack.getSubstrate();

	int sumLinkStress = 0;
	for (SubstrateLink sl : sNetwork.getEdges())
		sumLinkStress += Utils.getStressLevel(sl);

	return (sumLinkStress / (double) sNetwork.getEdges().size());
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:10,代码来源:AvLinkStress.java

示例15: calculate

import vnreal.network.substrate.SubstrateNetwork; //导入方法依赖的package包/类
public double calculate(NetworkStack stack) {
	SubstrateNetwork sNetwork = stack.getSubstrate();

	int max = 0;
	for (SubstrateLink sl : sNetwork.getEdges()) {
		int stress = Utils.getStressLevel(sl);
		if (stress > max) {
			max = stress;
		}
	}

	return max;
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:14,代码来源:MaxLinkStress.java


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