Разработка иерархии классов и интерфейсов для предметной области "Напитки", страница 5

_dateOfManufacture = dateOfManufacture;

}

/** Set name of the drink */

public void setName(String name){

_name = name;

}

public void setDateOfManufacture(Date dateOfManufacture){

this._dateOfManufacture = dateOfManufacture;

}

/** Set the presence of alcohol */

public void setIsAlcohol(boolean isAlcohol){

_isAlcohol = isAlcohol;

}

/** Set drink is fizzy or not */

public void setIsFizzy(boolean isFizzy){

_isFizzy = isFizzy;

}

/** Set drink is hot or not */

public void setIsHot(boolean isHot){

_isHot = isHot;

}

public void setID(int id){

_id = id;

}

public void setMakerID(int makerID){

_makerID = makerID;

}

public void setSupplierID(int supplierID){

_supplierID = supplierID;

}

public void setWarehouseID(int warehouseID){

_warehouseID = warehouseID;

}

/** Get name of the drink */

public String getName(){

return this._name;

}

public Date getDateOfManufacture(){

return this._dateOfManufacture;

}

/** Get the presence of alcohol */

public boolean getIsAlcohol(){

return this._isAlcohol;

}

/** Get drink is fizzy or not */

public boolean getIsFizzy(){

return this._isFizzy;

}

/** Get drink is hot or not */

public boolean getIsHot(){

return this._isHot;

}

public int getID(){

return this._id;

}

public int getMakerID(){

return this._makerID;

}

public int getSupplierID(){

return this._supplierID;

}

public int getWarehouseID(){

return this._warehouseID;

}

}

public class Maker implements Serializable{

/** Maker address */

private int _addressID;

/** Maker id */

private int _id;

/** The name of the maker */

private String _name;

public Maker(String name, int addressID, int id){

_name = name;

_addressID = addressID;

_id = id;

}

/** Get maker address */

public int getAddressID(){

return this._addressID;

}

/** Get maker name */

public String getName(){

return this._name;

}

/** Get maker id */

public int get_id(){

return this._id;

}

}

public class MakerManager implements Serializable{

private ArrayList<Maker> _maker;

/** delete */

int last_id = 0;

public int getLastID(){

return last_id;

}

/** delete */

public MakerManager(){

_maker = new ArrayList<Maker>();

}

public void Add(String name, int addressID){

_maker.add(new Maker(name, addressID, last_id));

/** delete */

last_id++;

/** delete */

}

/** Get maker address */

public int getAddressID(int index){

return this._maker.get(index).getAddressID();

}

/** Get maker name */

public String getName(int index){

return this._maker.get(index).getName();

}

/** Get maker id */

public int getID(int index){

return this._maker.get(index).get_id();

}

public int getLength(){

return this._maker.size();

}

public int getIndexByID(int id){

for(int i = 0; i < _maker.size(); i++){

if(_maker.get(i).get_id() == id){

return i;

}

}

return -1;

}

}

public class Portion extends Beverage {

/** Price of one portion */

private float _price;

/** Volume of one portion (milliliter) */

private int _volume;

/** Weight of one portion (gram) */

private int _weight;

/*public Portion(String name, boolean isAlcohol, boolean isFizzy, boolean isHot, Date dateOfManufacture, int makerID, int supplierID, int warehouseID, float price, int volume, int weight){

super(name, isAlcohol, isFizzy, isHot, dateOfManufacture, makerID, supplierID, warehouseID);

_price = price;

_volume = volume;

_weight = weight;

}*/

public Portion(String name, boolean isAlcohol, boolean isFizzy, boolean isHot, Date dateOfManufacture, int makerID, int supplierID, int warehouseID, int id, float price, int volume, int weight){

super(name, isAlcohol, isFizzy, isHot, dateOfManufacture, makerID, supplierID, warehouseID, id);