⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 boundssupport.java

📁 简介: 今天为网友提供的是JAVA源码
💻 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();
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -