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


Java AbstractConstraint类代码示例

本文整理汇总了Java中vnreal.constraints.AbstractConstraint的典型用法代码示例。如果您正苦于以下问题:Java AbstractConstraint类的具体用法?Java AbstractConstraint怎么用?Java AbstractConstraint使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getCopy

import vnreal.constraints.AbstractConstraint; //导入依赖的package包/类
@Override
public AbstractResource getCopy(
		NetworkEntity<? extends AbstractConstraint> owner, boolean setOccupied) {

	PhysicalProvidedSecurity clone;
	
	if(owner.getClass().getSimpleName().contains("Node"))
		clone = new PhysicalProvidedSecurity((Node<? extends AbstractConstraint>)owner, this.getName());
	else if(owner.getClass().getSimpleName().contains("Link"))
		clone = new PhysicalProvidedSecurity((Link<? extends AbstractConstraint>)owner, this.getName());
	else
		throw new Error("The class: "+owner.getClass()+" is invalid for "+this.getClass().getSimpleName());
	
	clone.level = level;
	return clone;
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:17,代码来源:PhysicalProvidedSecurity.java

示例2: transform

import vnreal.constraints.AbstractConstraint; //导入依赖的package包/类
@Override
public String transform(V n) {
	if (enabled) {
		List<? extends AbstractConstraint> constraints = n.get();
		StringBuilder labelSb = new StringBuilder();
		labelSb.append("<html>");
		labelSb.append(n.toString());
		labelSb.append("<ul>");
		for (AbstractConstraint c : constraints) {
			labelSb.append("<li>");
			labelSb.append(c.toString());
			labelSb.append("</li>");
		}
		labelSb.append("</ul></html>");
		return labelSb.toString();
	} else
		return null;
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:19,代码来源:NodeToolTipTransformer.java

示例3: transform

import vnreal.constraints.AbstractConstraint; //导入依赖的package包/类
@Override
public String transform(E e) {
	if (enabled) {
		StringBuilder labelSb = new StringBuilder();
		labelSb.append("<html>" + e.toString() + "<ul>");
		for (AbstractConstraint c : e.get()) {
			labelSb.append("<li>");
			labelSb.append(c.toString());
			labelSb.append("</li>");
		}
		if (e.getClass().equals(VirtualLink.class))
			for (AbstractConstraint hh : ((VirtualLink) e)
					.getHiddenHopDemands()) {
				labelSb.append("<li>HH ");
				labelSb.append(hh.toString());
				labelSb.append("</li>");
			}
		labelSb.append("</ul></html>");
		return labelSb.toString();
	} else
		return null;
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:23,代码来源:LinkToolTipTransformer.java

示例4: doAction

import vnreal.constraints.AbstractConstraint; //导入依赖的package包/类
@Override
protected void doAction() {
	if (comboBox.getSelectedIndex() > 0) {
		try {
			// get the selected constraint.
			AbstractConstraint cons = entity.get().get(
					comboBox.getSelectedIndex() - 1);

			// edit the parameters, as specified by the users.
			for (int i = 0; i < paramNames.size(); i++) {
				Method setter = getSetterIgnoreCase(cons.getClass()
						.getDeclaredMethods(), paramNames.get(i));
				Class<?>[] paramType = setter.getParameterTypes();
				setter.invoke(
						cons,
						getParamValue(paramType[0], paramValues.get(i)
								.getText()));
			}
		} catch (Exception ex) {
			ex.printStackTrace();
			throw new AssertionError(
					"An error occured while trying to add a constraint.");
		}
	}
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:26,代码来源:EditConstraintDialog.java

示例5: occupyResource

import vnreal.constraints.AbstractConstraint; //导入依赖的package包/类
public static ResourceDemandEntry occupyResource(
		AbstractDemand dem,
		AbstractResource res) {
	
	if (res.accepts(dem) && res.fulfills(dem) && dem.occupy(res)) {
		return new ResourceDemandEntry(res, dem);
	}
	
	String ms = "";
	for (AbstractConstraint c : res.getOwner().get()) {
		for (Mapping m : c.getMappings())
			ms += "MAPPING: " + m.getResource().getClass().getSimpleName() + ":" + m.getResource() + " .. " + m.getDemand().getClass().getSimpleName() + ":" + m.getDemand().toString() + "\n";
	}
	
	throw new AssertionError(dem.getClass().getSimpleName() + ":" + dem + "\n\n" + res.getClass().getSimpleName() + ":" + res + "\n\n" + ms);
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:17,代码来源:Utils.java

示例6: calculate

import vnreal.constraints.AbstractConstraint; //导入依赖的package包/类
@Override
public double calculate(NetworkStack stack) {
	double totalCPU = 0;
	for (VirtualNetwork vn : stack.getVirtuals()) {
		for (VirtualNode vnode : vn.getVertices() ) {
			AbstractConstraint dem = vnode.get(CpuDemand.class);
			if (dem != null) {
				totalCPU += ((CpuDemand) dem).getDemandedCycles();
			}
		}
	}
	return totalCPU;
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:14,代码来源:TotalCPUDem.java

示例7: getCopy

import vnreal.constraints.AbstractConstraint; //导入依赖的package包/类
@Override
public AbstractResource getCopy(
		NetworkEntity<? extends AbstractConstraint> owner, boolean setOccupied) {

	StaticEnergyResource clone = new StaticEnergyResource(
			(Node<? extends AbstractConstraint>) owner, consumption, this.getName());
	clone.usedBy = usedBy;

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

示例8: getCopy

import vnreal.constraints.AbstractConstraint; //导入依赖的package包/类
@Override
public AbstractResource getCopy(
		NetworkEntity<? extends AbstractConstraint> owner, boolean setOccupied) {

	CommonResource clone = new CommonResource((NetworkEntity<? extends AbstractConstraint>) owner, this.getName());
	clone.capacity = capacity;
	
	if (setOccupied)
		clone.occupiedCapacity = occupiedCapacity;

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

示例9: getCopy

import vnreal.constraints.AbstractConstraint; //导入依赖的package包/类
@Override
public AbstractResource getCopy(
		NetworkEntity<? extends AbstractConstraint> owner, boolean setOccupied) {

	FreeSlotsResource clone = new FreeSlotsResource(this.label, this.slots, (Node<? extends AbstractConstraint>) owner, this.getName());

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

示例10: getCopy

import vnreal.constraints.AbstractConstraint; //导入依赖的package包/类
@Override
public AbstractResource getCopy(
		NetworkEntity<? extends AbstractConstraint> owner, boolean setOccupied) {

	PhysicalDemandedSecurity clone;
	if(owner.getClass().getSimpleName().contains("Node"))
		clone = new PhysicalDemandedSecurity((Node<? extends AbstractConstraint>)owner, this.getName());
	else if(owner.getClass().getSimpleName().contains("Link"))
		clone = new PhysicalDemandedSecurity((Link<? extends AbstractConstraint>)owner, this.getName());
	else
		throw new Error("The class: "+owner.getClass()+" is invalid for "+this.getClass().getSimpleName());
	clone.level = level;
	return clone;
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:15,代码来源:PhysicalDemandedSecurity.java

示例11: getCopy

import vnreal.constraints.AbstractConstraint; //导入依赖的package包/类
@Override
public AbstractResource getCopy(
		NetworkEntity<? extends AbstractConstraint> owner, boolean setOccupied) {

	StaticDelayResource clone = null;
		clone = new StaticDelayResource(owner, delayMS);
	
	return clone;
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:10,代码来源:StaticDelayResource.java

示例12: getCopy

import vnreal.constraints.AbstractConstraint; //导入依赖的package包/类
@Override
public AbstractResource getCopy(
		NetworkEntity<? extends AbstractConstraint> owner, boolean setOccupied) {

	VolatileCpuResource clone = new VolatileCpuResource(this.cycles, owner, this.getName(), this.isSwitch);
	
	if (setOccupied)
		clone.occupiedCycles = occupiedCycles;

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

示例13: getCopy

import vnreal.constraints.AbstractConstraint; //导入依赖的package包/类
@Override
public AbstractResource getCopy(
		NetworkEntity<? extends AbstractConstraint> owner, boolean setOccupied) {

	BandwidthResource clone = null;
		clone = new BandwidthResource((Link<? extends AbstractConstraint>) owner, this.getName());
	
	clone.bandwidth = bandwidth;
	
	if (setOccupied)
		clone.occupiedBandwidth = occupiedBandwidth;

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

示例14: getCapacityResource

import vnreal.constraints.AbstractConstraint; //导入依赖的package包/类
private AbstractResource getCapacityResource() {
	for (AbstractConstraint c : this.getOwner().get()) {
		if (this.getOwner() instanceof Node && c instanceof CapacityResource)
			return ((CapacityResource) c);
		if (this.getOwner() instanceof Link && c instanceof BandwidthResource)
			return ((BandwidthResource) c);
	}
	
	throw new AssertionError();
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:11,代码来源:BackupResource.java

示例15: MultiCoreEnergyResource

import vnreal.constraints.AbstractConstraint; //导入依赖的package包/类
public MultiCoreEnergyResource(Node<? extends AbstractConstraint> owner,
		Integer idleConsumption, Integer additionalConsumptionPerCore,
		Integer numberOfCores) {

	super(owner);
	this.idleConsumption = idleConsumption;
	this.additionalConsumptionPerCore = additionalConsumptionPerCore;
	this.numberOfCores = numberOfCores;
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:10,代码来源:MultiCoreEnergyResource.java


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