public class PreferenceLoader
extends java.lang.Object
Constructor and Description |
---|
PreferenceLoader() |
Modifier and Type | Method and Description |
---|---|
static PreferenceConfiguration |
loadPreferenceConfiguration(java.lang.String configPath,
ProductConfiguration productConfiguration,
java.util.Set<ConsumerAgentGroup> consumerAgentGroups)
Method to load the preference configuration from the configPath as JSON file
|
static java.util.Set<ProductGroupAttributeValueMapping> |
loadProductAttributePreferenceMapping(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Object>> papMapping,
java.util.Map<ProductGroup,java.util.Map<java.lang.String,ProductGroupAttribute>> productGroupMap,
java.util.Set<ConsumerAgentGroup> consumerAgentGroups)
Method to load a ProductAttributePreferenceMapping from a preference configuration object (papaMapping), a map of product groups and their corresponding attributes and a set of consumer agents
|
public static PreferenceConfiguration loadPreferenceConfiguration(java.lang.String configPath, ProductConfiguration productConfiguration, java.util.Set<ConsumerAgentGroup> consumerAgentGroups) throws java.lang.IllegalArgumentException, java.io.IOException, com.fasterxml.jackson.core.JsonParseException, com.fasterxml.jackson.databind.JsonMappingException
configPath
- The (relative) path the decision configuration file is located atproductConfiguration
- The configuration object of the products used in the simulation. Needs to contain at least the products the preference configuration refers toconsumerAgentGroups
- The configuration object of the consumer agent groups used in the simulation. Needs to contain at least the consumer agent groups the preference configuration refers tojava.lang.IllegalArgumentException
- Will be thrown when the configuration of the preferences (in the config path) is erroneousjava.io.IOException
- Will be thrown when an error occurs handling the file storing the configuration of the referred preference configurationcom.fasterxml.jackson.core.JsonParseException
- Will be thrown upon a parse error for the json file corresponding to the file handlercom.fasterxml.jackson.databind.JsonMappingException
- Will be thrown upon a mapping error for the json file corresponding to the file handlerpublic static java.util.Set<ProductGroupAttributeValueMapping> loadProductAttributePreferenceMapping(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Object>> papMapping, java.util.Map<ProductGroup,java.util.Map<java.lang.String,ProductGroupAttribute>> productGroupMap, java.util.Set<ConsumerAgentGroup> consumerAgentGroups) throws java.lang.IllegalArgumentException
papMapping
- A configuration object representing a preference product attribute mappingproductGroupMap
- A map associating product group attributes and their name with their respective product groupsconsumerAgentGroups
- The consumer agents whose values are to be mapped to product group attributesjava.lang.IllegalArgumentException
- Will be thrown when an entry (value or mapping strength) misses in the configuration or is invalid or one of the helping methods throws an (IA) exception