Package microsim.data

Class MultiKeyCoefficientMap

java.lang.Object
org.apache.commons.collections4.map.AbstractIterableMap<K,V>
org.apache.commons.collections4.map.AbstractMapDecorator<org.apache.commons.collections4.keyvalue.MultiKey<? extends K>,V>
org.apache.commons.collections4.map.MultiKeyMap
microsim.data.MultiKeyCoefficientMap
All Implemented Interfaces:
Serializable, Cloneable, Map, org.apache.commons.collections4.Get, org.apache.commons.collections4.IterableGet, org.apache.commons.collections4.IterableMap, org.apache.commons.collections4.Put

public class MultiKeyCoefficientMap extends org.apache.commons.collections4.map.MultiKeyMap
This class is an implementation of a Map that has multiple keys and multiple values at the same time.
See Also:
  • Field Details

  • Constructor Details

    • MultiKeyCoefficientMap

      public MultiKeyCoefficientMap(@NonNull @NonNull String @Nullable [] keys, @Nullable @Nullable String @Nullable [] values)
      Creates an empty new MultiKeyCoefficientMap with the names of the keys and values categories specified by String[] keys and String[] values arguments.
      Parameters:
      keys - A String array listing the names of the categories of keys.
      values - A String array listing the names of the categories of values.
      Throws:
      NullPointerException - when keys or any of its elements is 0.
    • MultiKeyCoefficientMap

      public MultiKeyCoefficientMap(@NonNull @NonNull org.apache.commons.collections4.map.AbstractHashedMap map, @NonNull @NonNull String @Nullable [] keys, @Nullable @Nullable String @Nullable [] values)
      Creates a new MultiKeyCoefficientMap with values stored in map, and with the names of the keys and values categories specified by String[] keys and String[] values arguments.
      Parameters:
      map - Contains the values of the MultiKeyCoefficientMap.
      keys - A String array listing the names of the categories of keys.
      values - A String array listing the names of the categories of values.
      Throws:
      NullPointerException - when map is null.
  • Method Details

    • toStringKey

      @NonNull public static @NonNull String toStringKey(@NonNull @NonNull Object value)
      Converts value to a String.
      Parameters:
      value - An object that can be String, Double, or Boolean.
      Returns:
      the string representation of value.
      Throws:
      NullPointerException - when value is null.
    • getValue

      @Nullable public @Nullable Object getValue(@NonNull @NonNull Object @NonNull ... key)
      Extracts the value that corresponds to key from the map.
      Parameters:
      key - A key or an array of keys.
      Returns:
      the value that corresponds to key.
      Throws:
      NullPointerException - when key is null or when it's an array containing at least one null object.
      IllegalArgumentException - when the total number of keys in key exceeds a certain threshold.
    • putValue

      public void putValue(@NonNull @NonNull Object @NonNull ... keyValues)
      Adds a value to the map.
      Parameters:
      keyValues - A single key or an array or keys.
      Throws:
      NullPointerException - when the input is null or contains null.
      IllegalArgumentException - when the number of keys exceeds the limit.
    • getKeysNames

      @NonNull public @NonNull String @Nullable [] getKeysNames()
      This method allows an instance of the MultiKeyCoefficientMap to provide a clone of the names of the keys. This is especially useful for getting the name of the variables used as keys in the microsim.statistics.regression classes.
      Returns:
      a String array clone of the names of the MultiKeyCoefficientMap's keys.
    • getValuesNames

      @NonNull public @NonNull String @Nullable [] getValuesNames()
      This method allows an instance of the MultiKeyCoefficientMap to provide a clone of the names of the values.
      Returns:
      a String array clone of the names of the MultiKeyCoefficientMap's values
    • clone

      public MultiKeyCoefficientMap clone()
      Overrides:
      clone in class org.apache.commons.collections4.map.MultiKeyMap
      Returns:
      a deep clone copy of the MultiKeyCoefficientMap object