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


Java SubstrateLink.add方法代码示例

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


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

示例1: generateRandomBandwidthResources

import vnreal.network.substrate.SubstrateLink; //导入方法依赖的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: generate

import vnreal.network.substrate.SubstrateLink; //导入方法依赖的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

示例3: generate

import vnreal.network.substrate.SubstrateLink; //导入方法依赖的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

示例4: generate

import vnreal.network.substrate.SubstrateLink; //导入方法依赖的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

示例5: generate

import vnreal.network.substrate.SubstrateLink; //导入方法依赖的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

示例6: generateRandomDelayResources

import vnreal.network.substrate.SubstrateLink; //导入方法依赖的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

示例7: generateRandomBandwidthResources

import vnreal.network.substrate.SubstrateLink; //导入方法依赖的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

示例8: generateRandomDelayResources

import vnreal.network.substrate.SubstrateLink; //导入方法依赖的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

示例9: process

import vnreal.network.substrate.SubstrateLink; //导入方法依赖的package包/类
@Override
public Scenario process(Scenario scen) {
	
	SubstrateNetwork sNet = scen.getSubstrate();
	
	for(SubstrateLink l : sNet.getEdges()) {
		BandwidthResource bw = new BandwidthResource(l);
		int value = min.intValue() + rng.nextInt(max.intValue() - min.intValue());
		bw.setBandwidth((double) value);
		l.add(bw);
	}
	return scen;
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:14,代码来源:BWResourceElement.java

示例10: constructSubstrateNetwork

import vnreal.network.substrate.SubstrateLink; //导入方法依赖的package包/类
private static SubstrateNetwork constructSubstrateNetwork(Network network) {
	// Build substrate network.
	SubstrateNetwork substrate = new SubstrateNetwork(false);

	// Convert vertices to substrate nodes.
	Map<Vertex, SubstrateNode> vertToSubnode = new HashMap<Vertex, SubstrateNode>();
	for (Vertex vert : network.vertices) {
		SubstrateNode node = new SubstrateNode();

		node.setCoordinateX(vert.lon);
		node.setCoordinateY(-1*vert.lat);

		String name = vert.asNumber+":"+vert.id;
		if (vert.name != null) {
			name += " (" + vert.name + ")";
		}
		node.setName(name);

		substrate.addVertex(node);
		vertToSubnode.put(vert, node);
	}

	// Convert edges to substrate links.
	for (Edge edge : network.edges) {
		SubstrateLink linkA = new SubstrateLink();
		SubstrateLink linkB = new SubstrateLink();

		if (edge.bandwidth != null) {
			BandwidthResource bwA = new BandwidthResource(linkA);
			bwA.setBandwidth((double) edge.bandwidth);
			linkA.add(bwA);

			BandwidthResource bwB = new BandwidthResource(linkB);
			bwB.setBandwidth((double) edge.bandwidth);
			linkB.add(bwB);
		}

		// TODO convert type, weight, delay and length to resources

		SubstrateNode nodeA = vertToSubnode.get(edge.vertA);
		SubstrateNode nodeB = vertToSubnode.get(edge.vertB);
		substrate.addEdge(linkA, nodeA, nodeB);
		substrate.addEdge(linkB, nodeB, nodeA);
	}

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

示例11: createSubstLinks

import vnreal.network.substrate.SubstrateLink; //导入方法依赖的package包/类
/**
 * Add new edge between sourceNode and destNode
 * 
 * @param	substNetwork
 * @param	sourceNode
 * @param	destNode
 * @param	bwResource
 *          
 * @return 	substrateNetwork with nodes end new edge
 */
private static void createSubstLinks(SubstrateNetwork substNetwork, SubstrateNode sourceNode, SubstrateNode destNode, double bwResource){
	BandwidthResource bwRes;
	SubstrateLink subsLink = new SubstrateLink();
	bwRes = new BandwidthResource(subsLink);
	bwRes.setBandwidth(bwResource);
	subsLink.add(bwRes);
	substNetwork.addEdge(subsLink, sourceNode, destNode);
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:19,代码来源:MetisIO.java


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