Class ProductionConsumptionKnowledge
- java.lang.Object
-
- ch.sahits.game.openpatrician.engine.player.ProductionConsumptionKnowledge
-
- All Implemented Interfaces:
IProductionConsumptionKnowledge
public class ProductionConsumptionKnowledge extends java.lang.Object implements IProductionConsumptionKnowledge
Implementation of the knowlege of all cities
-
-
Field Summary
Fields Modifier and Type Field Description private BlockadeState
blockade
private PopulationConsume
consume
private org.springframework.context.ApplicationContext
context
private IMap
map
private java.util.Map<ICity,ICityProductionConsumptionKnowledge>
productionAndConsumption
private CityProductionAndConsumptionService
productionAndConsumptionService
private MapProxy
proxy
-
Constructor Summary
Constructors Constructor Description ProductionConsumptionKnowledge()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<ICity>
findCitiesWithNeedMinimalDistance(ICity distanceToCity, IWare ware, INavigableVessel vessel)
Find cities that need theware
and order them based on the need and the distance.java.util.List<ICity>
findListWithConsumptionMinimalDistance(ICity distanceToCity, IWare ware, INavigableVessel vessel)
Find cities that consume the ware and order them based on consumption amount and distance.java.util.List<ICity>
findListWithProductionsMinimalDistance(ICity distanceToCity, IWare ware, INavigableVessel vessel)
Find cities that produce the ware and order them based on production amount and distance.ICityProductionConsumptionKnowledge
getKnowlege(ICity city)
Retrieve the knowledge for a city.private void
init()
void
updateKnowledge(ICity city)
Update the knowledge of the city.
-
-
-
Field Detail
-
productionAndConsumption
private java.util.Map<ICity,ICityProductionConsumptionKnowledge> productionAndConsumption
-
productionAndConsumptionService
@Autowired private CityProductionAndConsumptionService productionAndConsumptionService
-
map
@Autowired private IMap map
-
context
@Autowired private org.springframework.context.ApplicationContext context
-
consume
@Autowired private PopulationConsume consume
-
blockade
@Autowired private BlockadeState blockade
-
proxy
@Autowired private MapProxy proxy
-
-
Method Detail
-
init
@PostConstruct @IgnoreOnDeserialisation private void init()
-
updateKnowledge
public void updateKnowledge(ICity city)
Description copied from interface:IProductionConsumptionKnowledge
Update the knowledge of the city. An update of the knowledge uses the exact value.- Specified by:
updateKnowledge
in interfaceIProductionConsumptionKnowledge
- Parameters:
city
- for which the knowledge should be updated.
-
getKnowlege
public ICityProductionConsumptionKnowledge getKnowlege(ICity city)
Description copied from interface:IProductionConsumptionKnowledge
Retrieve the knowledge for a city.- Specified by:
getKnowlege
in interfaceIProductionConsumptionKnowledge
- Parameters:
city
- for which to retrieve the production and consumption knowledge- Returns:
- city specific production and consomption knowledge
-
findListWithProductionsMinimalDistance
public java.util.List<ICity> findListWithProductionsMinimalDistance(ICity distanceToCity, IWare ware, INavigableVessel vessel)
Description copied from interface:IProductionConsumptionKnowledge
Find cities that produce the ware and order them based on production amount and distance.- Specified by:
findListWithProductionsMinimalDistance
in interfaceIProductionConsumptionKnowledge
- Parameters:
distanceToCity
- city to which the producing city's distance should be considered.ware
- that should be produced.vessel
- for which the list is retrieved- Returns:
- ordered list with the best production option at the beginning
-
findListWithConsumptionMinimalDistance
public java.util.List<ICity> findListWithConsumptionMinimalDistance(ICity distanceToCity, IWare ware, INavigableVessel vessel)
Description copied from interface:IProductionConsumptionKnowledge
Find cities that consume the ware and order them based on consumption amount and distance.- Specified by:
findListWithConsumptionMinimalDistance
in interfaceIProductionConsumptionKnowledge
- Parameters:
distanceToCity
- city to which the consuming city's distance should be considered.ware
- that should be consumed.vessel
- for which the list is retrieved- Returns:
- ordered list with the best consumption option at the beginning
-
findCitiesWithNeedMinimalDistance
public java.util.List<ICity> findCitiesWithNeedMinimalDistance(ICity distanceToCity, IWare ware, INavigableVessel vessel)
Description copied from interface:IProductionConsumptionKnowledge
Find cities that need theware
and order them based on the need and the distance.- Specified by:
findCitiesWithNeedMinimalDistance
in interfaceIProductionConsumptionKnowledge
- Parameters:
distanceToCity
- city to which the consuming city's distance should be considered.ware
- that should be consumedvessel
- for which the list is retrieved- Returns:
- ordered list with the cities that need the ware the most.
-
-