?? boundssupport.java
字號:
package com.power.pipeengine.Report;
import java.util.*;
import java.io.*;
import com.power.pipeengine.Variable.*;
import com.power.pipeengine.Constraint.*;
import com.power.pipeengine.InputData.*;
import com.power.pipeengine.LPModel.*;
import com.power.pipeengine.Entity.*;
import com.power.pipeengine.*;
import com.power.pipe.*;
public class BoundsSupport extends Report
{
static ResourceBundle res = ResourceBundle.getBundle("com.power.pipeengine.Res",
EngineConfig.getInstance().getLocale() );
private static final BoundsSupport INSTANCE =
new BoundsSupport();
// Private constructor supresses
// default public constructor
private BoundsSupport( ) {
_fileName = "BoundsSupport";
//initFileWriter();
}
public static BoundsSupport getInstance( ) {
return INSTANCE;
}
private StringBuffer content = new StringBuffer();
public void createReport() throws IOException {
DataModel dataModel = DataModel.getInstance();
ProductBounds prodBnds = dataModel.getProductBounds();
PIPECalendar cal = dataModel.getCalendar();
BoundVariable bndVar = BoundVariable.getInstance();
Solution sol = Solution.getInstance();
String separator = GlobalConfig.getInstance().getSeparator();
Enumeration allBnds = prodBnds.getProductBounds().elements();
Routes routes = dataModel.getRoutes();
int numBuckets = cal.getTotalNumOfBuckets();
//FileWriter fileWriter = new FileWriter( outDir + _fileName );
while( allBnds.hasMoreElements() ) {
ProductBound prodBnd = (ProductBound) allBnds.nextElement();
Facility f = prodBnd.getFacility();
Product p = prodBnd.getProduct();
for( int t=1; t<=numBuckets; t++ ) {
Bound bnd = prodBnd.getBound( t );
if( null == bnd ) continue;
String bndType = bnd.getBndType();
if( bndType.equals( res.getString("UP") ) ) continue;
int bndQty = (int) bnd.getBndQty();
Bucket b = cal.getBucket( t );
Vector qualifyRoutes = routes.getRoutes( prodBnd.getFacilityID(),
prodBnd.getProductID() );
if( null == qualifyRoutes ) continue;
String var = bndVar.getVariable( bndType, f, p, b );
int value = (int) ( sol.getValue( var ) + EngineConfig.getInstance().PRECISION );
double supportLevel = 100* ( bndQty - value ) / bndQty;
String lineOut = f.getFacilityID() + separator +
p.getProductID() + separator +
b.getBucketID() + separator +
b.getFormatedDate() + separator +
bndQty + separator +
( bndQty - value ) + separator +
supportLevel + "\n";
content.append( lineOut );
}
}
//_myFileWriter.close();
super.flush( content.toString() );
content = null;
System.gc();
}
public void reset() {
content = new StringBuffer();
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -