Added nothing in fact...
This commit is contained in:
parent
4193fdade4
commit
43eb9a2464
@ -1,4 +1,28 @@
|
|||||||
package cz.cvut.fel.sit.omo.foodchain.factory;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,48 +5,68 @@ import cz.cvut.fel.sit.omo.foodchain.util.Singleton;
|
|||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
|
||||||
public class FactoryManager {
|
public class FactoryManager
|
||||||
//todo
|
{
|
||||||
public NodeFactory getNodeFactoryInstance() {
|
public NodeFactory getNodeFactoryInstance()
|
||||||
try {
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
return Singleton.getInstance(NodeFactory.class);
|
return Singleton.getInstance(NodeFactory.class);
|
||||||
} catch (IllegalAccessException | InstantiationException | NoSuchMethodException | InvocationTargetException e) {
|
}
|
||||||
|
catch (IllegalAccessException | InstantiationException | NoSuchMethodException | InvocationTargetException e)
|
||||||
|
{
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ChannelFactory getChannelFactoryInstance() {
|
public ChannelFactory getChannelFactoryInstance()
|
||||||
try {
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
return Singleton.getInstance(ChannelFactory.class);
|
return Singleton.getInstance(ChannelFactory.class);
|
||||||
} catch (IllegalAccessException | InstantiationException | NoSuchMethodException | InvocationTargetException e) {
|
}
|
||||||
|
catch (IllegalAccessException | InstantiationException | NoSuchMethodException | InvocationTargetException e)
|
||||||
|
{
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ScenarioFactory getScenarioFactoryInstance() {
|
public ScenarioFactory getScenarioFactoryInstance()
|
||||||
try {
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
return Singleton.getInstance(ScenarioFactory.class);
|
return Singleton.getInstance(ScenarioFactory.class);
|
||||||
} catch (IllegalAccessException | InstantiationException | NoSuchMethodException | InvocationTargetException e) {
|
}
|
||||||
|
catch (IllegalAccessException | InstantiationException | NoSuchMethodException | InvocationTargetException e)
|
||||||
|
{
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProductFactory getProductFactoryInstance() {
|
public ProductFactory getProductFactoryInstance()
|
||||||
try {
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
return Singleton.getInstance(ProductFactory.class);
|
return Singleton.getInstance(ProductFactory.class);
|
||||||
} catch (IllegalAccessException | InstantiationException | NoSuchMethodException | InvocationTargetException e) {
|
}
|
||||||
|
catch (IllegalAccessException | InstantiationException | NoSuchMethodException | InvocationTargetException e)
|
||||||
|
{
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PoolDatabase getPoolDatabaseInstance() {
|
public PoolDatabase getPoolDatabaseInstance()
|
||||||
try {
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
return Singleton.getInstance(PoolDatabase.class);
|
return Singleton.getInstance(PoolDatabase.class);
|
||||||
} catch (IllegalAccessException | InstantiationException | NoSuchMethodException | InvocationTargetException e) {
|
}
|
||||||
|
catch (IllegalAccessException | InstantiationException | NoSuchMethodException | InvocationTargetException e)
|
||||||
|
{
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
package cz.cvut.fel.sit.omo.foodchain.factory;
|
package cz.cvut.fel.sit.omo.foodchain.factory;
|
||||||
|
|
||||||
public class NodeFactory {
|
public class NodeFactory
|
||||||
|
{
|
||||||
|
//make
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,12 @@
|
|||||||
package cz.cvut.fel.sit.omo.foodchain.factory;
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
package cz.cvut.fel.sit.omo.foodchain.factory;
|
package cz.cvut.fel.sit.omo.foodchain.factory;
|
||||||
|
|
||||||
public class ScenarioFactory {
|
public class ScenarioFactory
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user