Class TripletImpl<V,E>

java.lang.Object
org.aksw.commons.util.triplet.TripletImpl<V,E>
All Implemented Interfaces:
Triplet<V,E>

public class TripletImpl<V,E> extends Object implements Triplet<V,E>
  • Field Details

    • subject

      protected V subject
    • predicate

      protected E predicate
    • object

      protected V object
  • Constructor Details

    • TripletImpl

      public TripletImpl(V subject, E predicate, V object)
  • Method Details

    • makeDirected

      public static <V, E> Triplet<V,Directed<E>> makeDirected(Triplet<V,E> in, V source)
    • makeUndirected

      public static <V, E> Triplet<V,E> makeUndirected(Triplet<V,Directed<E>> in)
    • create

      public static <V, E> Triplet<V,E> create(V s, E e, V o, boolean reverse)
    • getSource

      public static <V> V getSource(Triplet<V,?> triplet, boolean reverse)
    • getTarget

      public static <V> V getTarget(Triplet<V,?> triplet, boolean reverse)
    • getTarget

      public static <V> V getTarget(Triplet<V,?> triplet, Object source)
    • getDirections

      public static List<Boolean> getDirections(Triplet<?,?> triplet, Object node)
      Return a list of indices based on whether the given node is equal to the triple's subject and/or object.
      Parameters:
      triplet -
      node -
      Returns:
    • getDirection

      public static int getDirection(Triplet<?,?> triplet, Object node)
      Returns a bit mask: index: 1 0 [bwdBit] [fwdBit] The first bit indicates whether the subject was equal to the given node, the second bit whether the object was equal to the given node. Possible values are therefore 0 (no match), 3 (both subject and object matched) or 1 and 2.
      Parameters:
      triplet -
      node -
      Returns:
    • getSubject

      public V getSubject()
      Specified by:
      getSubject in interface Triplet<V,E>
    • getPredicate

      public E getPredicate()
      Specified by:
      getPredicate in interface Triplet<V,E>
    • getObject

      public V getObject()
      Specified by:
      getObject in interface Triplet<V,E>
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object