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
ConstructorsConstructorDescriptionCreates 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 TypeMethodDescriptionbooleanadds a given pair of generic elements to the set.booleanadds all given elements to the preference orderbooleanadds two given (single) elements as pair into the setvoidclear()clears the current preference order element setbooleancompares this preference order to another given one whether each relation is contained in bothbooleanchecks whether this preference order contains a given pairbooleancontainsAll(Collection<?> c) checks, whether all of the given elements are contained in the preference orderbooleancontainsRelation(T a, T b) checks whether this preference order contains a pair of given elementsbooleancontainsTriple(T firstElement, T secondElement, Relation relation) checks whether the given triple is containedbooleanchecks 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 elementsbooleanisEmpty()returns whether the set is empty or notbooleanreturns whether the elements a and b are relatedbooleanisTotal()checks whether the set is total or notbooleanchecks whether the given set is transitive or notbooleanisValid()checks whether the given set represents a valid preference orderiterator()returns an iterator over a set of triplesbooleanremoves specific pair of the setbooleanremoveAll(Collection<?> c) removes all given elements from the preference orderbooleanretainAll(Collection<?> c) intsize()returns the size of the setvoidstrengthenElementInLF(T element) strengthens the given element in this preference order in its leveling functionvoidstrengthenElementInRF(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 setvoidweakenElementInLF(T element) weakens the given element in this preference order in its leveling functionvoidweakenElementInRF(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, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods 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:
getDomainElementsin 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:
isRelatedin 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:
isTotalin interfaceBinaryRelation<T>- Returns:
- true if total, false otherwise
-
isTransitive
public boolean isTransitive()checks whether the given set is transitive or not- Specified by:
isTransitivein interfaceBinaryRelation<T>- Returns:
- true if transitive, false otherwise
-
isValid
public boolean isValid()checks whether the given set represents a valid preference order- Specified by:
isValidin 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:
containsAllin interfaceCollection<T>- Specified by:
containsAllin 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
-