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

📄 inventory.java

📁 简介: 今天为网友提供的是JAVA源码
💻 JAVA
字号:
package com.power.pipeengine.Entity;

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

public class Inventory
{
    private String _productID;
	private int _facilityID;
	private Vector _buckets = new Vector();
	private Vector _qtys = new Vector();

	public Inventory( String prod, int facility ) {
		_productID = prod;
		_facilityID = facility;
	}

	public void addEntry( int bucketID, double qty ) {
		PIPECalendar cal = DataModel.getInstance().getCalendar();
		_buckets.addElement( cal.getBucket( bucketID ) );
		_qtys.addElement( new Double( qty ) );
	}

	public double getInventoryQty( Bucket b ) {
		for( int i=0; i<_buckets.size(); i++ ) {
			Bucket bucket = (Bucket) _buckets.elementAt(i);
			if( bucket.getBucketID() != b.getBucketID() ) continue;

			return ((Double) _qtys.elementAt(i)).doubleValue();
		}
		return 0;
	}

	public double getInventoryQty( int bucketID ) {
		Bucket b = DataModel.getInstance().getCalendar().getBucket( bucketID );

		return getInventoryQty( b );
	}

	public void print() {
		System.out.println( _productID + "," + _facilityID );
		for( int i=0; i<_buckets.size(); i++ ) {
			Bucket b = (Bucket) _buckets.elementAt(i);
			Double qty = (Double) _qtys.elementAt(i);
			System.out.println( "\t(" + b.getBucketID() + ", " + qty + ")" );
		}
	}

}

⌨️ 快捷键说明

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