public class ValueConversionHelper
extends java.lang.Object
| Constructor and Description |
|---|
ValueConversionHelper() |
| Modifier and Type | Method and Description |
|---|---|
static java.awt.geom.Point2D |
arrayList2DtoPoint2D(java.util.ArrayList<java.lang.Double> twoTuple)
Method to convert a 2-tupel ArrayList representation of a point (with Double coordinates)
into a Point2D(.Double) format
|
static java.util.HashMap<java.lang.String,java.lang.Object>[] |
arrayListHashMapToArrayHashMap(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Object>> arrayListToConvert)
Method to convert an ArrayList of HashMaps (of String-Object pairs) into an Array of HashMaps (of String-Object pairs)
|
static java.util.Set<java.lang.String> |
arrayListToSet(java.util.ArrayList<java.lang.String> stringsToConvert)
Method to copy the strings contained in an Array list into a set.
|
static java.util.Map<ConsumerAgentGroup,java.lang.Integer> |
deriveCAGIntegerMap(java.util.Set<ConsumerAgentGroup> consumerAgentGroups,
java.util.HashMap<java.lang.String,java.lang.Integer> consumerGroupIntegerMapping,
java.lang.String context)
Method to transform a String-Integer map to a ConsumerAgentGroup-Integer map
with the ConsumerAgentGroup corresponding to the keys of the String-Integer map.
|
static java.util.Set<Need> |
getCorrespondingNeeds(java.util.Set<java.lang.String> needsSatisfied,
java.util.Map<java.lang.String,Need> needsMap)
Method to select all needs from a String-Need map as from a set of Strings.
|
static java.util.Map<java.lang.Integer,java.util.Set<Product>> |
IntegerFPDSetMapToIntegerProductSetMap(java.util.Map<java.lang.Integer,java.util.Set<FixedProductDescription>> initiallyAdoptedFPDs,
SimulationContainer simulationContainer)
Method to convert a map of Integer keys and sets of FixedProductDescription to a map
of the same integer keys with set of products corresponding to the instances of the FixedProductDescriptions as values
|
static java.util.ArrayList<Value> |
linkedHashMapToArrayList(java.util.LinkedHashMap<Value,java.lang.Double> orderedFactorMap)
Method to convert an ordered LinkedHashMap of Value-Double pairs to an array list of the same order
|
static java.util.Set<ProductGroup> |
ProductGroupCollectionToSet(java.util.Collection<ProductGroup> productGroups)
Method to convert a Collection of productGroups to a set of these
|
static java.util.ArrayList<java.lang.Double> |
SetToArrayList(java.util.Set<java.lang.Double> setToConvert)
Method to convert a set of Double values to an array list.
|
static boolean |
signToBoolean(double doubleToConvert)
Method to convert a numerical representation of a boolean value into a boolean value.
|
static java.util.Set<ConsumerAgent> |
synchronousConsumerAgentsToConsumerAgents(java.util.Set<SynchronousConsumerAgent> agentsInCAG)
Method to convert a set of SynchronousConsumerAgents to a set of ConsumerAgents
|
public static boolean signToBoolean(double doubleToConvert)
doubleToConvert - The (double representation) value to convert to booleanpublic static java.util.ArrayList<java.lang.Double> SetToArrayList(java.util.Set<java.lang.Double> setToConvert)
throws java.lang.IllegalArgumentException
setToConvert - Set of numbers to convert to a listjava.lang.IllegalArgumentException - Will be thrown when the set is emptypublic static java.awt.geom.Point2D arrayList2DtoPoint2D(java.util.ArrayList<java.lang.Double> twoTuple)
throws java.lang.IllegalArgumentException
twoTuple - The two tuple (as an ArrayList of Double values) to convert to a point, with first coordinate as x-Coordinate, and second coordinate as y-Coordinatejava.lang.IllegalArgumentException - Will be thrown when the dimension of the parameter is not 2 (not a 2-tuple)public static java.util.HashMap<java.lang.String,java.lang.Object>[] arrayListHashMapToArrayHashMap(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Object>> arrayListToConvert)
throws java.lang.IllegalArgumentException
arrayListToConvert - The ArrayList of hash maps that is to be converted to an array of hash mapsjava.lang.IllegalArgumentException - Will be thrown when the array list to convert is emptypublic static java.util.Set<Need> getCorrespondingNeeds(java.util.Set<java.lang.String> needsSatisfied, java.util.Map<java.lang.String,Need> needsMap) throws java.lang.IllegalArgumentException
needsSatisfied - String representation of the needs satisfied whose corresponding needs are to be selectedneedsMap - The needs map, mapping the provided strings with their desired needsjava.lang.IllegalArgumentException - Will be thrown if the set of Strings is empty or one of them is not a key of the needsMappublic static java.util.Set<java.lang.String> arrayListToSet(java.util.ArrayList<java.lang.String> stringsToConvert)
throws java.lang.IllegalArgumentException
stringsToConvert - The (Arraylist of) strings to convert into a setjava.lang.IllegalArgumentException - Will be thrown if the array list is empty or contains duplicate entriespublic static java.util.Set<ConsumerAgent> synchronousConsumerAgentsToConsumerAgents(java.util.Set<SynchronousConsumerAgent> agentsInCAG) throws java.lang.IllegalArgumentException
agentsInCAG - SynchronousConsumerAgents to be convertedjava.lang.IllegalArgumentException - will be thrown if the set to convert is emptypublic static java.util.Set<ProductGroup> ProductGroupCollectionToSet(java.util.Collection<ProductGroup> productGroups) throws java.lang.IllegalArgumentException
productGroups - The Collection to convert to a setjava.lang.IllegalArgumentException - Will be thrown when collection is emptypublic static java.util.Map<java.lang.Integer,java.util.Set<Product>> IntegerFPDSetMapToIntegerProductSetMap(java.util.Map<java.lang.Integer,java.util.Set<FixedProductDescription>> initiallyAdoptedFPDs, SimulationContainer simulationContainer) throws java.lang.IllegalArgumentException
initiallyAdoptedFPDs - The map which values are to be converted to setssimulationContainer - The container the simulation runs injava.lang.IllegalArgumentException - Will be throw if the map is empty, the container is null, or a FixedProductDescription doesn't not have a corresponding product in the simulationpublic static java.util.ArrayList<Value> linkedHashMapToArrayList(java.util.LinkedHashMap<Value,java.lang.Double> orderedFactorMap) throws java.lang.IllegalArgumentException
orderedFactorMap - The (ordered) map to be convertedjava.lang.IllegalArgumentException - Gets thrown when the argument is an empty mappublic static java.util.Map<ConsumerAgentGroup,java.lang.Integer> deriveCAGIntegerMap(java.util.Set<ConsumerAgentGroup> consumerAgentGroups, java.util.HashMap<java.lang.String,java.lang.Integer> consumerGroupIntegerMapping, java.lang.String context) throws java.lang.IllegalArgumentException
consumerAgentGroups - The potential keys for the CAG-Integer mapconsumerGroupIntegerMapping - The String-Integer map with the keys referring to existing CAGscontext - A String describing the context the method was called from (for a more verbose Exception)java.lang.IllegalArgumentException - Will be thrown when a key of the String-Integer map doesn't refer to an agent group given as argument