T - the generic type of objects/pairs in this preference orderpublic class PreferenceOrder<T> extends java.lang.Object implements BinaryRelation<T>
| Modifier and Type | Field and Description |
|---|---|
private java.util.Set<Triple<T,T,Relation>> |
relations
a given set of Triples
|
| Constructor and Description |
|---|
PreferenceOrder()
Creates an empty HashSet of preference order.
|
PreferenceOrder(java.util.Collection<? extends Triple<T,T,Relation>> relations)
generates a preference order with a given set of elements
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(Triple<T,T,Relation> t)
adds a given pair of generic elements to the set.
|
boolean |
addAll(java.util.Collection<? extends Triple<T,T,Relation>> c)
adds all given elements to the preference order
|
boolean |
addPair(T f,
T s,
Relation relation)
adds two given (single) elements as pair into the set
|
void |
clear()
clears the current preference order element set
|
boolean |
compareEqualityWith(PreferenceOrder<T> po)
compares this preference order to another given one whether each relation
is contained in both
|
boolean |
contains(java.lang.Object o)
checks whether this preference order contains a given pair
|
boolean |
containsAll(java.util.Collection<?> c)
checks, whether all of the given elements are contained in the preference
order
|
boolean |
containsRelation(T a,
T b)
checks whether this preference order contains a pair of given elements
|
boolean |
containsTriple(T firstElement,
T secondElement,
Relation relation) |
boolean |
equals(java.lang.Object obj) |
Triple<T,T,Relation> |
get(Triple<T,T,Relation> e)
checks existence and returns a demanded pair
|
java.util.Set<T> |
getDomainElements()
(re-)computes a set of single elements in this preference order
|
LevelingFunction<T> |
getLevelingFunction()
returns the ranking function for this preference order
|
Triple<T,T,Relation> |
getTriple(T a,
T b)
returns a pair if it consists of of two given elements
|
boolean |
isEmpty()
returns whether the set is empty or not
|
boolean |
isRelated(T a,
T b)
returns whether the elements a and b are related
|
boolean |
isTotal()
checks whether the set is total or not
|
boolean |
isTransitive()
checks whether the given set is transitive or not
|
boolean |
isValid()
checks whether the given set represents a valid preference order
|
java.util.Iterator<Triple<T,T,Relation>> |
iterator()
an Iterator over all relations in this po
|
java.util.Iterator<Triple<T,T,Relation>> |
iterator(java.util.Set<Triple<T,T,Relation>> s)
returns an iterator over a set of pairs
|
boolean |
remove(java.lang.Object o)
removes specific pair of the set
|
boolean |
removeAll(java.util.Collection<?> c)
removes all given elements from the preference order
|
boolean |
retainAll(java.util.Collection<?> c) |
int |
size()
returns the size of the set
|
void |
strengthenElementInLF(T element)
strengthens the given element in this preference order in its leveling
function
|
void |
strengthenElementInRF(T element)
strengthens the given element in this preference order in its ranking
function
|
java.lang.Object[] |
toArray()
returns an array containing all objects
|
<T> T[] |
toArray(T[] a)
returns all elements in an array
|
java.lang.String |
toString()
returns a String with the elements of this set
|
void |
weakenElementInLF(T element)
weakens the given element in this preference order in its leveling
function
|
void |
weakenElementInRF(T element)
weakens the given element in this preference order in its ranking
function
|
public PreferenceOrder()
public LevelingFunction<T> getLevelingFunction()
public boolean addPair(T f, T s, Relation relation)
f - first element of the new pairs - second element of the new pairpublic java.util.Set<T> getDomainElements()
getDomainElements in interface BinaryRelation<T>public boolean remove(java.lang.Object o)
public boolean isEmpty()
public boolean isRelated(T a, T b)
isRelated in interface BinaryRelation<T>a - the first element to be checkedb - the second element to be checkedpublic java.util.Iterator<Triple<T,T,Relation>> iterator(java.util.Set<Triple<T,T,Relation>> s)
public Triple<T,T,Relation> get(Triple<T,T,Relation> e)
e - the demanded pairpublic Triple<T,T,Relation> getTriple(T a, T b)
a - the first elementb - the second elementpublic boolean containsRelation(T a, T b)
a - the first elementb - the second elementpublic boolean contains(java.lang.Object o)
public boolean containsTriple(T firstElement, T secondElement, Relation relation)
firstElement - secondElement - relation - public int size()
public java.lang.String toString()
toString in interface BinaryRelation<T>toString in class java.lang.Objectpublic java.lang.Object[] toArray()
public <T> T[] toArray(T[] a)
public boolean isTotal()
isTotal in interface BinaryRelation<T>public boolean isTransitive()
isTransitive in interface BinaryRelation<T>public boolean isValid()
isValid in interface BinaryRelation<T>public void clear()
public boolean containsAll(java.util.Collection<?> c)
public boolean removeAll(java.util.Collection<?> c)
public boolean retainAll(java.util.Collection<?> c)
public boolean addAll(java.util.Collection<? extends Triple<T,T,Relation>> c)
public java.util.Iterator<Triple<T,T,Relation>> iterator()
public boolean equals(java.lang.Object obj)
public boolean compareEqualityWith(PreferenceOrder<T> po)
po - the preference order to compare withpublic void weakenElementInLF(T element)
element - the element to be weakenpublic void strengthenElementInLF(T element)
element - the element to be strengthenpublic void weakenElementInRF(T element)
element - the element to be weakenpublic void strengthenElementInRF(T element)
element - the element to be strengthen