Class LevelingFunction<T>

  • Type Parameters:
    T - the generic type used for this leveling function
    All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.util.Map<T,​java.lang.Integer>

    public class LevelingFunction<T>
    extends Functions<T>
    This class is meant to provide leveling functions to given preference orders and vice versa. TODO exception handling for invalid preference orders (total preorder)
    Author:
    Bastian Wolf
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.util.AbstractMap

        java.util.AbstractMap.SimpleEntry<K extends java.lang.Object,​V extends java.lang.Object>, java.util.AbstractMap.SimpleImmutableEntry<K extends java.lang.Object,​V extends java.lang.Object>
      • Nested classes/interfaces inherited from interface java.util.Map

        java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>
    • Constructor Summary

      Constructors 
      Constructor Description
      LevelingFunction()
      constructs a new, empty leveling function caller can use Map-method putAll to fill this empty leveling function
      LevelingFunction​(PreferenceOrder<T> po)
      this constructor creates a leveling function using a given preference order
    • Method Summary

      Modifier and Type Method Description
      PreferenceOrder<T> generatePreferenceOrder()
      this method returns a preference order made out of this leveling function
      java.util.Map<T,​java.lang.Integer> getLevelingFunction()
      returns this leveling function
      RankingFunction<T> getRankingFunction()  
      void strengthenElement​(T element)
      strengthens the given element in the leveling function
      void weakenElement​(T element)
      weakens the given element in the leveling function
      • Methods inherited from class java.util.HashMap

        clear, clone, compute, computeIfAbsent, computeIfPresent, entrySet, forEach, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size
      • Methods inherited from class java.util.AbstractMap

        equals, hashCode
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Map

        clear, compute, computeIfAbsent, computeIfPresent, entrySet, equals, forEach, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size
    • Constructor Detail

      • LevelingFunction

        public LevelingFunction()
        constructs a new, empty leveling function caller can use Map-method putAll to fill this empty leveling function
      • LevelingFunction

        public LevelingFunction​(PreferenceOrder<T> po)
        this constructor creates a leveling function using a given preference order
        Parameters:
        po - the given preference order
    • Method Detail

      • getLevelingFunction

        public java.util.Map<T,​java.lang.Integer> getLevelingFunction()
        returns this leveling function
        Overrides:
        getLevelingFunction in class Functions<T>
        Returns:
        this leveling function
      • generatePreferenceOrder

        public PreferenceOrder<T> generatePreferenceOrder()
        this method returns a preference order made out of this leveling function
        Specified by:
        generatePreferenceOrder in class Functions<T>
        Returns:
        a preference order out of a given leveling function
      • weakenElement

        public void weakenElement​(T element)
        weakens the given element in the leveling function
        Specified by:
        weakenElement in class Functions<T>
        Parameters:
        element - the element being weakened
      • strengthenElement

        public void strengthenElement​(T element)
        strengthens the given element in the leveling function
        Specified by:
        strengthenElement in class Functions<T>
        Parameters:
        element - the element being strengthened