?? routeproduct.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 + -