Class Product
- java.lang.Object
-
- cz.cvut.fel.sit.omo.foodchain.product.Product
-
public class Product extends java.lang.ObjectProduct class
-
-
Field Summary
Fields Modifier and Type Field Description private OperationBasecurrentOperationprivate java.lang.Stringnameprivate javax.money.MonetaryAmountpriceprivate ProductStateproductStateprivate ProductTypeproductTypeprivate javax.money.MonetaryAmountstartPrice
-
Constructor Summary
Constructors Constructor Description Product(java.lang.String name, ProductType productType, double m)
-
Method Summary
Modifier and Type Method Description java.lang.Stringaccept(ReportTextVisitor visitor)OperationBasegetCurrentOperation()java.util.List<OperationBase>getListOfOperations()java.lang.StringgetName()javax.money.MonetaryAmountgetPrice()ProductStategetProductState()ProductTypegetProductType()javax.money.MonetaryAmountgetStartPrice()voidsetCurrentOperation(OperationBase currentOperation)voidsetName(java.lang.String name)voidsetPrice(javax.money.MonetaryAmount price)voidsetProductType(ProductType productType)voidsetStateToAvailable()Set current product state to AVAILABLE.voidsetStateToInAction()Set current product state to IN_ACTION.voidsetStateToInRequirement()Set current product state to IN_REQUIREMENT.voidsetStateToInTransit()Set current product state to IN_TRANSIT.voidsetStateToReadyForDispatch()Set current product state to READY_FOR_DISPATCH.voidsetStateToReadyForReception()Set current product state to READY_FOR_RECEPTION.booleantick()Passes tick onto current operation
-
-
-
Field Detail
-
productState
private ProductState productState
-
productType
private ProductType productType
-
currentOperation
private OperationBase currentOperation
-
price
private javax.money.MonetaryAmount price
-
startPrice
private final javax.money.MonetaryAmount startPrice
-
name
private java.lang.String name
-
-
Constructor Detail
-
Product
public Product(java.lang.String name, ProductType productType, double m)
-
-
Method Detail
-
tick
public boolean tick()
Passes tick onto current operation- Returns:
- operation is active
-
setStateToAvailable
public void setStateToAvailable()
Set current product state to AVAILABLE. Throws IllegalStateException if the product is not IN_ACTION, READY_FOR_RECEPTION or IN_REQUIREMENT.
-
setStateToReadyForDispatch
public void setStateToReadyForDispatch()
Set current product state to READY_FOR_DISPATCH. Throws IllegalStateException if the product is not IN_REQUIREMENT.
-
setStateToInTransit
public void setStateToInTransit()
Set current product state to IN_TRANSIT. Throws IllegalStateException if the product is not READY_FOR_DISPATCH.
-
setStateToReadyForReception
public void setStateToReadyForReception()
Set current product state to READY_FOR_RECEPTION. Throws IllegalStateException if the product is not READY_FOR_RECEPTION.
-
setStateToInAction
public void setStateToInAction()
Set current product state to IN_ACTION. Throws IllegalStateException if the product is not AVAILABLE.
-
setStateToInRequirement
public void setStateToInRequirement()
Set current product state to IN_REQUIREMENT. Throws IllegalStateException if the product is not AVAILABLE.
-
getProductState
public ProductState getProductState()
-
getProductType
public ProductType getProductType()
-
setProductType
public void setProductType(ProductType productType)
-
getName
public java.lang.String getName()
-
setName
public void setName(java.lang.String name)
-
getCurrentOperation
public OperationBase getCurrentOperation()
-
setCurrentOperation
public void setCurrentOperation(OperationBase currentOperation)
-
getPrice
public javax.money.MonetaryAmount getPrice()
-
setPrice
public void setPrice(javax.money.MonetaryAmount price)
-
getStartPrice
public javax.money.MonetaryAmount getStartPrice()
-
getListOfOperations
public java.util.List<OperationBase> getListOfOperations()
-
accept
public java.lang.String accept(ReportTextVisitor visitor)
-
-