Class Functions<T>
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<T,java.lang.Integer>
-
- net.sf.tweety.preferences.ranking.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
-
-
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 mapboolean
containsValue(java.lang.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 functionjava.lang.Integer
get(java.lang.Object key)
returns the value to a given keyjava.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 functionjava.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 entryjava.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 entryabstract void
strengthenElement(T element)
strengthens the given element in the functionjava.lang.String
toString()
returns a string representation for this ranking functionjava.util.Collection<java.lang.Integer>
values()
returns a collection containing all values of the mapabstract void
weakenElement(T element)
weakens the given element in the function
-
-
-
Method Detail
-
toString
public java.lang.String toString()
returns a string representation for this ranking function- Overrides:
toString
in classjava.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
-
containsValue
public boolean containsValue(java.lang.Object value)
checks whether the value is present in the entry-set of the map
-
get
public java.lang.Integer get(java.lang.Object key)
returns the value to a given key
-
values
public java.util.Collection<java.lang.Integer> values()
returns a collection containing all values of the map
-
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
-
-