Class Functions<T>
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<T,Integer>
-
- net.sf.tweety.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:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object>
-
-
Constructor Summary
Constructors Constructor Description Functions()
-
Method Summary
Modifier and Type Method Description booleancontainsKey(Object key)checks whether the key is present in the entry-set of the mapbooleancontainsValue(Object value)checks whether the value is present in the entry-set of the mapabstract PreferenceOrder<T>generatePreferenceOrder()this method returns a preference order made out of an ranking functionIntegerget(Object key)returns the value to a given keySet<Map.Entry<T,Integer>>getElementsByValue(int val)returns an entry set of all elements in this ranking function with the same rank (= value)Map<T,Integer>getLevelingFunction()returns the ranking functionSet<Map.Entry<T,Integer>>getPredecessors(Map.Entry<T,Integer> element)returns a set of predecessor elements for the given entrySet<Map.Entry<T,Integer>>getSuccessors(Map.Entry<T,Integer> element)returns a set of successor elements for the given entryabstract voidstrengthenElement(T element)strengthens the given element in the functionStringtoString()returns a string representation for this ranking functionCollection<Integer>values()returns a collection containing all values of the mapabstract voidweakenElement(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
finalize, 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
-
-
-
-
Method Detail
-
toString
public String toString()
returns a string representation for this ranking function- Overrides:
toStringin classAbstractMap<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:
containsKeyin interfaceMap<T,Integer>- Overrides:
containsKeyin classHashMap<T,Integer>
-
containsValue
public boolean containsValue(Object value)
checks whether the value is present in the entry-set of the map- Specified by:
containsValuein interfaceMap<T,Integer>- Overrides:
containsValuein classHashMap<T,Integer>
-
values
public Collection<Integer> values()
returns a collection containing all values of the map
-
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
-
-