Merge branch 'develop' into feature/factory_impl

# Conflicts:
#	src/main/java/cz/cvut/fel/sit/omo/foodchain/factory/NodeFactory.java
#	src/main/java/cz/cvut/fel/sit/omo/foodchain/product/Product.java
This commit is contained in:
Daniel Poustka 2020-12-26 10:26:27 +01:00
commit 015d558afe
8 changed files with 26 additions and 12 deletions

Binary file not shown.

View File

@ -4,6 +4,10 @@ import java.util.Random;
public class Customer extends BuyerNodeBase {
public Customer(int startMoney) {
super();
}
public void consumeProduct() {
int i = new Random().nextInt(getStorage().size());
getStorage().remove(i);

View File

@ -1,4 +1,8 @@
package cz.cvut.fel.sit.omo.foodchain.node;
public class Distributor extends RetailerNodeBase {
public Distributor(int startMoney) {
super();
}
}

View File

@ -5,6 +5,10 @@ import cz.cvut.fel.sit.omo.foodchain.product.Product;
public class Farmer extends SellerNodeBase {
public Farmer(int startMoney) {
super();
}
public void generateProduct(Product product) {
storeProduct(product);
createRequirement(TransactionType.SALE, product.getProductType(), product.getName());

View File

@ -32,7 +32,7 @@ public class NodeBase implements ChannelObserver {
money = Monetary.getDefaultAmountFactory().setCurrency("USD").setNumber(0).create();
}
public NodeBase(int m) {
public NodeBase(double m) {
subscribedChannels = new HashMap<>();
products = new LinkedList<>();
refusedTranslations = new LinkedList<>();

View File

@ -1,4 +1,8 @@
package cz.cvut.fel.sit.omo.foodchain.node;
public class Processor extends RetailerNodeBase {
public Processor(int startMoney) {
super();
}
}

View File

@ -1,4 +1,8 @@
package cz.cvut.fel.sit.omo.foodchain.node;
public class Seller extends RetailerNodeBase {
public Seller(int startMoney) {
super();
}
}

View File

@ -72,7 +72,7 @@ public class Product
*/
public void setStateToReadyForDispatch()
{
if (this.productState.equals(ProductState.AVAILABLE))
if(this.productState.equals(ProductState.AVAILABLE))
this.productState = ProductState.READY_FOR_DISPATCH;
else
throw new IllegalStateException("Cannot set state READY_FOR_DISPATCH. Product is not AVAILABLE!");
@ -83,7 +83,7 @@ public class Product
*/
public void setStateToInTransit()
{
if (this.productState.equals(ProductState.READY_FOR_DISPATCH))
if(this.productState.equals(ProductState.READY_FOR_DISPATCH))
this.productState = ProductState.IN_TRANSIT;
else
throw new IllegalStateException("Cannot set state IN_TRANSIT. Product is not READY_FOR_DISPATCH!");
@ -94,7 +94,7 @@ public class Product
*/
public void setStateToReadyForReception()
{
if (this.productState.equals(ProductState.IN_TRANSIT))
if(this.productState.equals(ProductState.IN_TRANSIT))
this.productState = ProductState.READY_FOR_RECEPTION;
else
throw new IllegalStateException("Cannot set state READY_FOR_RECEPTION. Product has not been in transit!");
@ -144,13 +144,7 @@ public class Product
this.currentOperation = currentOperation;
}
public MonetaryAmount getMoney()
{
return money;
}
public MonetaryAmount getMoney() { return money; }
public void setMoney(MonetaryAmount money)
{
this.money = money;
}
public void setMoney(MonetaryAmount money) { this.money = money; }
}