Class Functions<T>

java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<T,Integer>
org.tweetyproject.preferences.ranking.Functions<T>
Type Parameters:
T - generic preference order type
All Implemented Interfaces:
Serializable, Cloneable, Map<T,Integer>
Direct Known Subclasses:
LevelingFunction, RankingFunction

public abstract class Functions<T> extends HashMap<T,Integer> implements Map<T,Integer>
An abstract class as superclass for two different ranking/leveling functions used to rank elements from preference orders
Author:
Bastian Wolf
See Also:
  • Constructor Details

    • Functions

      public Functions()
  • Method Details

    • toString

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

      public Map<T,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(Object key)
      checks whether the key is present in the entry-set of the map
      Specified by:
      containsKey in interface Map<T,Integer>
      Overrides:
      containsKey in class HashMap<T,Integer>
    • containsValue

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

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

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

      public Set<Map.Entry<T,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 Set<Map.Entry<T,Integer>> getPredecessors(Map.Entry<T,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 Set<Map.Entry<T,Integer>> getSuccessors(Map.Entry<T,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