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

📄 routeproduct.java

📁 著名IT公司ILog的APS高级排产优化引擎
💻 JAVA
字号:
package com.power.pipeengine.Entity;

import java.util.*;
import com.power.pipeengine.InputData.*;

public class RouteProduct
{
    private int _routeID;
	private String _productID;
	private Vector _effectiveBucket = new Vector();
	private Vector _splitFraction = new Vector();
	private Vector _timePhasedSplitData = new Vector();

	public RouteProduct( int rteID,
						 String prodID ) {
		_routeID = rteID;
		_productID = prodID;
	}

	public void addTimePhasedSplit( int bucketID, double fraction ) {
        for( int i=0; i< _effectiveBucket.size(); i++ ) {
            Integer anInt = (Integer)_effectiveBucket.elementAt( i );
            if( bucketID < anInt.intValue() ) {
                _effectiveBucket.add( i, new Integer( bucketID ) );
                _splitFraction.add( i, new Double( fraction ) );
                return;
            }
        }

        _effectiveBucket.addElement( new Integer( bucketID ) );
        _splitFraction.addElement( new Double( fraction ) );
	}

	public int getRouteID() {
		return _routeID;
	}

	public String getProductID() {
		return _productID;
	}

	public Route getRoute() {
		Routes routes = DataModel.getInstance().getRoutes();
		return routes.getRoute( _routeID );
	}

	public Product getProduct() {
		Products products = DataModel.getInstance().getProducts();
		return products.getProduct( getRoute().getDestFacilityID(), getProductID() );
	}

	public Vector getTimePhasedSplitData() {
		return _timePhasedSplitData;
	}

	public double getSplitFraction( int bucketID ) {
		return ((Double) _timePhasedSplitData.elementAt( bucketID -1 )).doubleValue();
	}

	public void buildTimePhasedSplitData() {
		for( int i=0; i<_effectiveBucket.size()-1; i++ ) {
			int currentBucket = ((Integer)_effectiveBucket.elementAt(i)).intValue();
			int nextBucket = ((Integer)_effectiveBucket.elementAt(i+1) ).intValue();
			for( int j=currentBucket; j<nextBucket; j++ ) {
				Double fraction = (Double) _splitFraction.elementAt( i );
				_timePhasedSplitData.addElement( fraction );
			}
		}

		//from last element to the end of horizon
		int currentBucket = ((Integer)_effectiveBucket.lastElement()).intValue();
		int numBuckets = DataModel.getInstance().getCalendar().getTotalNumOfBuckets();
		for( int i=currentBucket; i<=numBuckets; i++ ) {
			Double fraction = (Double) _splitFraction.lastElement();
			_timePhasedSplitData.addElement( fraction );
		}
	}

	public void print() {
		System.out.println( _routeID + "," +
							_productID + "," +
							_effectiveBucket + "," +
							_splitFraction );
	}

    public int hashCode() {
        return _routeID;
    }
}

⌨️ 快捷键说明

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