Interface BinaryRelation<T>

  • Type Parameters:
    T - the generic type of objects/pairs in this binary relation
    All Superinterfaces:
    java.util.Collection<Triple<T,​T,​Relation>>, java.lang.Iterable<Triple<T,​T,​Relation>>, java.util.Set<Triple<T,​T,​Relation>>
    All Known Implementing Classes:
    PreferenceOrder

    public interface BinaryRelation<T>
    extends java.util.Set<Triple<T,​T,​Relation>>
    This abstract class provides a basic implementation of a generic set of pairs to be used for preference ordering.
    Author:
    Bastian Wolf
    • Method Summary

      Modifier and Type Method Description
      boolean add​(Triple<T,​T,​Relation> t)
      adds a new triple containing two elements and its relation
      java.util.Set<T> getDomainElements()
      returns a set of the single elements in this binary relation
      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 preference order is valid (transitive, total and unique)
      java.lang.String toString()
      returns a String with the elements of this set
      • Methods inherited from interface java.util.Collection

        parallelStream, removeIf, stream, toArray
      • Methods inherited from interface java.lang.Iterable

        forEach
      • Methods inherited from interface java.util.Set

        addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, spliterator, toArray, toArray
    • Method Detail

      • add

        boolean add​(Triple<T,​T,​Relation> t)
        adds a new triple containing two elements and its relation
        Specified by:
        add in interface java.util.Collection<T>
        Specified by:
        add in interface java.util.Set<T>
        Parameters:
        t - the relation between those two elements (LESS or LESS_EQUAL)
        Returns:
        true if successful, false if not (e.g.: relation already exists)
      • isRelated

        boolean isRelated​(T a,
                          T b)
        returns whether the elements a and b are related
        Parameters:
        a - the first element to be checked
        b - the second element to be checked
        Returns:
        true if related, false if not.
      • getDomainElements

        java.util.Set<T> getDomainElements()
        returns a set of the single elements in this binary relation
        Returns:
        a set of the single elements in this binary relation
      • isTotal

        boolean isTotal()
        checks whether the set is total or not
        Returns:
        true if total, false otherwise
      • isTransitive

        boolean isTransitive()
        checks whether the given set is transitive or not
        Returns:
        true if transitive, false otherwise
      • isValid

        boolean isValid()
        checks whether the preference order is valid (transitive, total and unique)
        Returns:
        true if valid, false if not
      • toString

        java.lang.String toString()
        returns a String with the elements of this set
        Overrides:
        toString in class java.lang.Object
        Returns:
        a String with the elements of this set