吐血上传

源代码在线查看: materialuse.java

软件大小: 2611 K
上传用户: lxwcqq
关键词:
下载地址: 免注册下载 普通下载 VIP

相关代码

				package com.power.pipeengine.Entity;
				
				import java.util.*;
				
				import com.power.pipeengine.InputData.*;
				
				public class MaterialUse
				{
				    private String _materialID;
					private int _routeID;
					private Vector _effectiveBuckets = new Vector();
					private Vector _consumptionRate = new Vector();
					private Vector _consumptionSchedule = new Vector();
				
					public MaterialUse( String matID, int rteID ) {
						_materialID = matID;
						_routeID = rteID;
					}
				
					public String getMaterialID() {
						return _materialID;
					}
				
					public Route getRoute() {
						Routes routes = DataModel.getInstance().getRoutes();
						return routes.getRoute( _routeID );
					}
				
					public void addConsumptionRate( int bucketID, double rate ) {
						_effectiveBuckets.addElement( new Integer( bucketID ) );
						_consumptionRate.addElement( new Double( rate ) );
					}
				
					public void buildTimePhasedConsumption() {
						for( int i=0; i							int currentBucket = ((Integer)_effectiveBuckets.elementAt(i)).intValue();
							int nextBucket = ((Integer)_effectiveBuckets.elementAt(i+1) ).intValue();
							for( int j=currentBucket; j								Double rate = (Double) _consumptionRate.elementAt( i );
								_consumptionSchedule.addElement( rate );
							}
						}
				
						//from last element to the end of horizon
						int currentBucket = ((Integer)_effectiveBuckets.lastElement()).intValue();
						int numBuckets = DataModel.getInstance().getCalendar().getTotalNumOfBuckets();
						for( int i=currentBucket; i							Double rate = (Double) _consumptionRate.lastElement();
							_consumptionSchedule.addElement( rate );
						}
					}
				
					public double getConsumptionRate( int bucketID ) {
						Double rate = (Double) _consumptionSchedule.elementAt( bucketID-1 );
				
						return rate.doubleValue();
					}
				
					public void print() {
						System.out.println( _materialID + ", " +
											_routeID + ", " +
											_consumptionSchedule );
					}
				
				
				}
							

相关资源