今天为网友提供的是JAVA源码
源代码在线查看: startsvariable.java
package com.power.pipeengine.Variable;
import com.power.pipeengine.Entity.*;
import com.power.pipeengine.*;
import java.util.ResourceBundle;
public class StartsVariable
extends Variable {
private static final StartsVariable INSTANCE =
new StartsVariable();
// Private constructor supresses
// default public constructor
private StartsVariable() {
}
public static StartsVariable getInstance() {
return INSTANCE;
}
public String getVariable(Route r, Product p, Bucket b) {
String varName = new String("S" +
"R" + r.getVariableCode() +
"P" + p.getVariableCode() +
"T" + b.getVariableCode());
/*String separator = "";
String varName = new String( "S" +
r.getRouteID() + separator +
p.getProductID() + separator +
b.getBucketID() );*/
setObjElement(varName, r, b);
return varName;
}
public void setObjElement(String varName, Route r, Bucket b) {
//start as early as possible, or JIT
double cost = r.getCostPerStart();
//if (cost < 0.6) {
cost = 1;
//}
double coeff = 1;
for (int i = 0; i < b.getBucketID(); i++) {
coeff *= 10;
}
setObjElement(varName,
cost - (100 - b.getBucketID())/100 /*+ Math.random() * 0.0000001 - 0.000001 * b.getBucketID()*/);
}
}