_price = price;
_volume = volume;
_weight = weight;
}
/** Set price of one portion */
public void setPrice(float price){
_price = price;
}
/** Set volume of one portion (milliliter) */
public void setVolume(int volume){
_volume = volume;
}
/** Set weight of one portion (gram) */
public void setWeight(int weight){
_weight = weight;
}
/** Get price of one portion */
public float getPrice(){
return this._price;
}
/** Get volume of one portion (milliliter) */
public int getVolume(){
return this._volume;
}
/** Get weight of one portion (gram) */
public int getWeight(){
return this._weight;
}
}
public class PortionManager implements Serializable{
private ArrayList<Portion> _portions;
int last_id = 0;
public int getLastID(){
return last_id;
}
public PortionManager(){
_portions = new ArrayList<Portion>();
}
public void AddPortion(String name, boolean isAlcohol, boolean isFizzy, boolean isHot, Date dateOfManufacture, int makerID, int supplierID, int warehouseID, float price, int volume, int weight){
_portions.add(new Portion(name, isAlcohol, isFizzy, isHot, dateOfManufacture, makerID, supplierID, warehouseID, last_id, price, volume, weight));
last_id++;
}
public void EditPortion(String name, boolean isAlcohol, boolean isFizzy, boolean isHot, Date dateOfManufacture,float price, int volume, int weight, int index){
_portions.add(new Portion(name, isAlcohol, isFizzy, isHot, dateOfManufacture, _portions.get(index).getMakerID(), _portions.get(index).getSupplierID(), _portions.get(index).getWarehouseID(), _portions.get(index).getID(), price, volume, weight));
_portions.remove(index);
}
/** Get name of the drink */
public String getName(int index){
return this._portions.get(index).getName();
}
/** Get the presence of alcohol */
public boolean getIsAlcohol(int index){
return this._portions.get(index).getIsAlcohol();
}
/** Get drink is fizzy or not */
public boolean getIsFizzy(int index){
return this._portions.get(index).getIsFizzy();
}
/** Get drink is hot or not */
public boolean getIsHot(int index){
return this._portions.get(index).getIsHot();
}
public int getID(int index){
return this._portions.get(index).getID();
}
public int getMakerID(int index){
return this._portions.get(index).getMakerID();
}
public int getSupplierID(int index){
return this._portions.get(index).getSupplierID();
}
public int getWarehouseID(int index){
return this._portions.get(index).getWarehouseID();
}
/** Get price of one portion */
public float getPrice(int index){
return this._portions.get(index).getPrice();
}
/** Get volume of one portion (milliliter) */
public int getVolume(int index){
return this._portions.get(index).getVolume();
}
/** Get weight of one portion (gram) */
public int getWeight(int index){
return this._portions.get(index).getWeight();
}
public Date getDateOfManufacture(int index){
return this._portions.get(index).getDateOfManufacture();
}
public int getLength(){
return this._portions.size();
}
public void setSupplierID(int value, int index){
this._portions.get(index).setSupplierID(value);
}
public void setMakerID(int value, int index){
this._portions.get(index).setMakerID(value);
}
public void setWarehouseID(int value, int index){
this._portions.get(index).setWarehouseID(value);
}
public void DeletePortion(int id){
for(int i = 0; i < _portions.size(); i++){
if(_portions.get(i).getID() == id){
_portions.remove(i);
break;
}
}
}
public void DeletePortion(String name){
for(int i = 0; i < _portions.size(); i++){
if(_portions.get(i).getName().equals(name)){
_portions.remove(i);
break;
}
}
}
public int getIndexById(int id){
for(int i = 0; i < _portions.size(); i++){
if(_portions.get(i).getID() == id){
Уважаемый посетитель!
Чтобы распечатать файл, скачайте его (в формате Word).
Ссылка на скачивание - внизу страницы.