Class AIPlayerContext
- java.lang.Object
-
- ch.sahits.game.openpatrician.model.player.AIPlayerContext
-
public class AIPlayerContext extends java.lang.Object
Context holding data for various trade strategies for an AIPlayer.- Author:
- Andi Hotz, (c) Sahits GmbH, 2017 Created on Oct 05, 2017
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<BaseStrategyType<?>>
generalStrategyTypes
private com.google.common.collect.Multimap<ICity,ITradeStategyHint>
hints
private java.util.Map<IAITradeStrategyType,java.lang.Integer>
weightedStrategies
-
Constructor Summary
Constructors Constructor Description AIPlayerContext()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(ICity city, ITradeStategyHint hint)
Add a new hint to a city.void
add(BaseStrategyType<?> strategyType)
Add a new strategy type.void
addWeightedTradeStrategy(IAITradeStrategyType strategyType)
Add a new trade strategy to the weighted map.java.util.List<BaseStrategyType<?>>
getGeneralStrategyTypes()
java.util.List<ITradeStategyHint>
getHints(ICity city)
Retrieve all hints for the city.java.util.Map<IAITradeStrategyType,java.lang.Integer>
getWeightedStrategies()
Retrieve the weighted trade strategies.
-
-
-
Field Detail
-
hints
private com.google.common.collect.Multimap<ICity,ITradeStategyHint> hints
-
generalStrategyTypes
private java.util.List<BaseStrategyType<?>> generalStrategyTypes
-
weightedStrategies
private java.util.Map<IAITradeStrategyType,java.lang.Integer> weightedStrategies
-
-
Method Detail
-
add
public void add(ICity city, ITradeStategyHint hint)
Add a new hint to a city.- Parameters:
city
- for which to add the hinthint
- to be added
-
getHints
public java.util.List<ITradeStategyHint> getHints(ICity city)
Retrieve all hints for the city.- Parameters:
city
- for which to retrieve the hints- Returns:
- list of city hints.
-
getGeneralStrategyTypes
public java.util.List<BaseStrategyType<?>> getGeneralStrategyTypes()
-
add
public void add(BaseStrategyType<?> strategyType)
Add a new strategy type.- Parameters:
strategyType
- type of the strategy to be added
-
addWeightedTradeStrategy
public void addWeightedTradeStrategy(IAITradeStrategyType strategyType)
Add a new trade strategy to the weighted map. strategies can be added multiple times, which adds up the weight.- Parameters:
strategyType
- to be added.
-
getWeightedStrategies
public java.util.Map<IAITradeStrategyType,java.lang.Integer> getWeightedStrategies()
Retrieve the weighted trade strategies.- Returns:
- map of the weighted trade strategies.
-
-