Class Functions<T>

  • Type Parameters:
    T - generic preference order type
    All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.util.Map<T,​java.lang.Integer>
    Direct Known Subclasses:
    LevelingFunction, RankingFunction

    public abstract class Functions<T>
    extends java.util.HashMap<T,​java.lang.Integer>
    implements java.util.Map<T,​java.lang.Integer>
    An abstract class as superclass for two different ranking/leveling functions used to rank elements from preference orders
    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
      Functions()  
    • Method Summary

      Modifier and Type Method Description
      boolean containsKey​(java.lang.Object key)
      checks whether the key is present in the entry-set of the map
      boolean containsValue​(java.lang.Object value)
      checks whether the value is present in the entry-set of the map
      abstract PreferenceOrder<T> generatePreferenceOrder()
      this method returns a preference order made out of an ranking function
      java.lang.Integer get​(java.lang.Object key)
      returns the value to a given key
      java.util.Set<java.util.Map.Entry<T,​java.lang.Integer>> getElementsByValue​(int val)
      returns an entry set of all elements in this ranking function with the same rank (= value)
      java.util.Map<T,​java.lang.Integer> getLevelingFunction()
      returns the ranking function
      java.util.Set<java.util.Map.Entry<T,​java.lang.Integer>> getPredecessors​(java.util.Map.Entry<T,​java.lang.Integer> element)
      returns a set of predecessor elements for the given entry
      java.util.Set<java.util.Map.Entry<T,​java.lang.Integer>> getSuccessors​(java.util.Map.Entry<T,​java.lang.Integer> element)
      returns a set of successor elements for the given entry
      abstract void strengthenElement​(T element)
      strengthens the given element in the function
      java.lang.String toString()
      returns a string representation for this ranking function
      java.util.Collection<java.lang.Integer> values()
      returns a collection containing all values of the map
      abstract void weakenElement​(T element)
      weakens the given element in the 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

      • Functions

        public Functions()
    • Method Detail

      • toString

        public java.lang.String toString()
        returns a string representation for this ranking function
        Overrides:
        toString in class java.util.AbstractMap<T,​java.lang.Integer>
      • getLevelingFunction

        public java.util.Map<T,​java.lang.Integer> getLevelingFunction()
        returns the ranking function
        Returns:
        ranking function
      • generatePreferenceOrder

        public abstract PreferenceOrder<T> generatePreferenceOrder()
        this method returns a preference order made out of an ranking function
        Returns:
        a preference order out of a given ranking function
      • containsKey

        public boolean containsKey​(java.lang.Object key)
        checks whether the key is present in the entry-set of the map
        Specified by:
        containsKey in interface java.util.Map<T,​java.lang.Integer>
        Overrides:
        containsKey in class java.util.HashMap<T,​java.lang.Integer>
      • containsValue

        public boolean containsValue​(java.lang.Object value)
        checks whether the value is present in the entry-set of the map
        Specified by:
        containsValue in interface java.util.Map<T,​java.lang.Integer>
        Overrides:
        containsValue in class java.util.HashMap<T,​java.lang.Integer>
      • get

        public java.lang.Integer get​(java.lang.Object key)
        returns the value to a given key
        Specified by:
        get in interface java.util.Map<T,​java.lang.Integer>
        Overrides:
        get in class java.util.HashMap<T,​java.lang.Integer>
        Returns:
        the value if present, null otherwise (but value.equals(null) is possible)
      • values

        public java.util.Collection<java.lang.Integer> values()
        returns a collection containing all values of the map
        Specified by:
        values in interface java.util.Map<T,​java.lang.Integer>
        Overrides:
        values in class java.util.HashMap<T,​java.lang.Integer>
      • getElementsByValue

        public java.util.Set<java.util.Map.Entry<T,​java.lang.Integer>> getElementsByValue​(int val)
        returns an entry set of all elements in this ranking function with the same rank (= value)
        Parameters:
        val - the rank of the elements searched
        Returns:
        an entry set of all elements in this ranking function with the same rank (= value)
      • getPredecessors

        public java.util.Set<java.util.Map.Entry<T,​java.lang.Integer>> getPredecessors​(java.util.Map.Entry<T,​java.lang.Integer> element)
        returns a set of predecessor elements for the given entry
        Parameters:
        element - the given entry
        Returns:
        a set of predecessor elements for the given entry
      • getSuccessors

        public java.util.Set<java.util.Map.Entry<T,​java.lang.Integer>> getSuccessors​(java.util.Map.Entry<T,​java.lang.Integer> element)
        returns a set of successor elements for the given entry
        Parameters:
        element - the given entry
        Returns:
        a set of successor elements for the given entry
      • weakenElement

        public abstract void weakenElement​(T element)
        weakens the given element in the function
        Parameters:
        element - the element being weakened
      • strengthenElement

        public abstract void strengthenElement​(T element)
        strengthens the given element in the function
        Parameters:
        element - the element being strengthened