本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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.");
}
}
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
示例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;
}