Added nothing in fact...

This commit is contained in:
Daniel Poustka 2020-12-25 15:53:17 +01:00
parent 4193fdade4
commit 43eb9a2464
5 changed files with 76 additions and 21 deletions

View File

@ -1,4 +1,28 @@
package cz.cvut.fel.sit.omo.foodchain.factory;
public class ChannelFactory {
import cz.cvut.fel.sit.omo.foodchain.channel.*;
public class ChannelFactory
{
public enum ChannelType
{
Fruit, Vegetable, Meat, Other;
}
public ChannelBase makeChannel(ChannelType typeOfChannel)
{
switch (typeOfChannel)
{
case Fruit:
return new FruitChannel();
case Vegetable:
return new VegetableChannel();
case Meat:
return new MeatChannel();
case Other:
return new OtherChannel();
}
return null;
}
}

View File

@ -5,48 +5,68 @@ import cz.cvut.fel.sit.omo.foodchain.util.Singleton;
import java.lang.reflect.InvocationTargetException;
public class FactoryManager {
//todo
public NodeFactory getNodeFactoryInstance() {
try {
public class FactoryManager
{
public NodeFactory getNodeFactoryInstance()
{
try
{
return Singleton.getInstance(NodeFactory.class);
} catch (IllegalAccessException | InstantiationException | NoSuchMethodException | InvocationTargetException e) {
}
catch (IllegalAccessException | InstantiationException | NoSuchMethodException | InvocationTargetException e)
{
e.printStackTrace();
}
return null;
}
public ChannelFactory getChannelFactoryInstance() {
try {
public ChannelFactory getChannelFactoryInstance()
{
try
{
return Singleton.getInstance(ChannelFactory.class);
} catch (IllegalAccessException | InstantiationException | NoSuchMethodException | InvocationTargetException e) {
}
catch (IllegalAccessException | InstantiationException | NoSuchMethodException | InvocationTargetException e)
{
e.printStackTrace();
}
return null;
}
public ScenarioFactory getScenarioFactoryInstance() {
try {
public ScenarioFactory getScenarioFactoryInstance()
{
try
{
return Singleton.getInstance(ScenarioFactory.class);
} catch (IllegalAccessException | InstantiationException | NoSuchMethodException | InvocationTargetException e) {
}
catch (IllegalAccessException | InstantiationException | NoSuchMethodException | InvocationTargetException e)
{
e.printStackTrace();
}
return null;
}
public ProductFactory getProductFactoryInstance() {
try {
public ProductFactory getProductFactoryInstance()
{
try
{
return Singleton.getInstance(ProductFactory.class);
} catch (IllegalAccessException | InstantiationException | NoSuchMethodException | InvocationTargetException e) {
}
catch (IllegalAccessException | InstantiationException | NoSuchMethodException | InvocationTargetException e)
{
e.printStackTrace();
}
return null;
}
public PoolDatabase getPoolDatabaseInstance() {
try {
public PoolDatabase getPoolDatabaseInstance()
{
try
{
return Singleton.getInstance(PoolDatabase.class);
} catch (IllegalAccessException | InstantiationException | NoSuchMethodException | InvocationTargetException e) {
}
catch (IllegalAccessException | InstantiationException | NoSuchMethodException | InvocationTargetException e)
{
e.printStackTrace();
}
return null;

View File

@ -1,4 +1,6 @@
package cz.cvut.fel.sit.omo.foodchain.factory;
public class NodeFactory {
public class NodeFactory
{
//make
}

View File

@ -1,4 +1,12 @@
package cz.cvut.fel.sit.omo.foodchain.factory;
public class ProductFactory {
import cz.cvut.fel.sit.omo.foodchain.product.Product;
import cz.cvut.fel.sit.omo.foodchain.product.ProductType;
public class ProductFactory
{
public Product makeProduct(String name, ProductType productType)
{
return new Product(name, productType);
}
}

View File

@ -1,4 +1,5 @@
package cz.cvut.fel.sit.omo.foodchain.factory;
public class ScenarioFactory {
public class ScenarioFactory
{
}