Package org.tweetyproject.preferences
Class PreferenceOrder<T>
java.lang.Object
org.tweetyproject.preferences.PreferenceOrder<T>
- Type Parameters:
T
- the generic type of objects/pairs in this preference order
- All Implemented Interfaces:
Iterable<Triple<T,
,T, Relation>> Collection<Triple<T,
,T, Relation>> Set<Triple<T,
,T, Relation>> BinaryRelation<T>
This class extends the BinaryRelation-class with a check for totality and
transitivity
- Author:
- Bastian Wolf
-
Constructor Summary
ConstructorDescriptionCreates an empty HashSet of preference order.PreferenceOrder
(Collection<? extends Triple<T, T, Relation>> relations) generates a preference order with a given set of elements -
Method Summary
Modifier and TypeMethodDescriptionboolean
adds a given pair of generic elements to the set.boolean
adds all given elements to the preference orderboolean
adds two given (single) elements as pair into the setvoid
clear()
clears the current preference order element setboolean
compares this preference order to another given one whether each relation is contained in bothboolean
checks whether this preference order contains a given pairboolean
containsAll
(Collection<?> c) checks, whether all of the given elements are contained in the preference orderboolean
containsRelation
(T a, T b) checks whether this preference order contains a pair of given elementsboolean
containsTriple
(T firstElement, T secondElement, Relation relation) checks whether the given triple is containedboolean
checks existence and returns a demanded pair(re-)computes a set of single elements in this preference orderreturns the ranking function for this preference orderreturns a pair if it consists of of two given elementsboolean
isEmpty()
returns whether the set is empty or notboolean
returns whether the elements a and b are relatedboolean
isTotal()
checks whether the set is total or notboolean
checks whether the given set is transitive or notboolean
isValid()
checks whether the given set represents a valid preference orderiterator()
returns an iterator over a set of triplesboolean
removes specific pair of the setboolean
removeAll
(Collection<?> c) removes all given elements from the preference orderboolean
retainAll
(Collection<?> c) int
size()
returns the size of the setvoid
strengthenElementInLF
(T element) strengthens the given element in this preference order in its leveling functionvoid
strengthenElementInRF
(T element) strengthens the given element in this preference order in its ranking functionObject[]
toArray()
returns an array containing all objects<T> T[]
toArray
(T[] a) returns all elements in an arraytoString()
returns a String with the elements of this setvoid
weakenElementInLF
(T element) weakens the given element in this preference order in its leveling functionvoid
weakenElementInRF
(T element) weakens the given element in this preference order in its ranking functionMethods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.Set
hashCode, spliterator
-
Constructor Details
-
PreferenceOrder
public PreferenceOrder()Creates an empty HashSet of preference order. -
PreferenceOrder
generates a preference order with a given set of elements- Parameters:
relations
- the set of given element pairs
-
-
Method Details
-
getLevelingFunction
returns the ranking function for this preference order- Returns:
- the ranking function for this preference order
-
add
-
addPair
-
getDomainElements
(re-)computes a set of single elements in this preference order- Specified by:
getDomainElements
in interfaceBinaryRelation<T>
- Returns:
- a set of the single elements in this binary relation
-
remove
-
isEmpty
-
isRelated
returns whether the elements a and b are related- Specified by:
isRelated
in interfaceBinaryRelation<T>
- Parameters:
a
- the first element to be checkedb
- the second element to be checked- Returns:
- true if related, false if not.
-
iterator
-
get
-
getTriple
-
containsRelation
-
contains
-
containsTriple
-
size
-
toString
-
toArray
-
toArray
-
isTotal
public boolean isTotal()checks whether the set is total or not- Specified by:
isTotal
in interfaceBinaryRelation<T>
- Returns:
- true if total, false otherwise
-
isTransitive
public boolean isTransitive()checks whether the given set is transitive or not- Specified by:
isTransitive
in interfaceBinaryRelation<T>
- Returns:
- true if transitive, false otherwise
-
isValid
public boolean isValid()checks whether the given set represents a valid preference order- Specified by:
isValid
in interfaceBinaryRelation<T>
- Returns:
- true if valid, false if not
-
clear
-
containsAll
checks, whether all of the given elements are contained in the preference order- Specified by:
containsAll
in interfaceCollection<T>
- Specified by:
containsAll
in interfaceSet<T>
- Returns:
- true iff all elements are contained, false otherwise
-
removeAll
removes all given elements from the preference order -
retainAll
-
addAll
-
iterator
-
equals
-
compareEqualityWith
compares this preference order to another given one whether each relation is contained in both- Parameters:
po
- the preference order to compare with- Returns:
- true if both are equal, false if not
-
weakenElementInLF
weakens the given element in this preference order in its leveling function- Parameters:
element
- the element to be weaken
-
strengthenElementInLF
strengthens the given element in this preference order in its leveling function- Parameters:
element
- the element to be strengthen
-
weakenElementInRF
weakens the given element in this preference order in its ranking function- Parameters:
element
- the element to be weaken
-
strengthenElementInRF
strengthens the given element in this preference order in its ranking function- Parameters:
element
- the element to be strengthen
-