java.lang.Object
java.lang.Record
com.darkcollective.relix.provenance.Route
Record Components:
edges - the canonical (sorted, de-duplicated) edge tokens; never null (empty = ε)
All Implemented Interfaces:
Comparable<Route>

public record Route(List<String> edges) extends Record implements Comparable<Route>
One derivation (path) carried by the cheapest-route semiring PathCostSemiring — the set of edge tokens traversed. The empty route is ε, the witness of the free derivation (the multiplicative identity).

Each token names a base-tuple occurrence (by convention <relation>#<ordinal>, the same naming the lineage semiring uses), so a route records which edges form the cheapest path. The edge set — rather than an ordered sequence — is what keeps the semiring's ⊗ (series composition = set union) commutative and associative, the K-relation contract a non-commutative concatenation would break. The traversal order (and human-readable edge labels) is a separable rendering nicety this record does not provide; the tokens are held in a canonical sorted order so the natural order the route-set cap relies on is deterministic.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Route(List<String> edges)
    Canonicalises edges into a sorted, de-duplicated immutable copy, so that routes built in any order compare and combine identically (the source of ⊗ commutativity).
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Orders routes by edge count, then lexicographically by token — a total order, so the cheapest-route semiring's route-set capping is deterministic.
    Returns the value of the edges record component.
    static Route
    Returns the empty route ε.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    static Route
    of(String... tokens)
    Returns a route of the given edge tokens.
    then(Route other)
    Returns this route composed in series with other.
    Returns the route rendered as t1·t2·t3 (sorted), or ε when empty.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Route

      public Route(List<String> edges)
      Canonicalises edges into a sorted, de-duplicated immutable copy, so that routes built in any order compare and combine identically (the source of ⊗ commutativity).
      Parameters:
      edges - the edge tokens; never null, no null element
  • Method Details

    • empty

      public static Route empty()
      Returns the empty route ε. The witness of the free derivation.
      Returns:
      the empty route ε
    • of

      public static Route of(String... tokens)
      Returns a route of the given edge tokens.
      Parameters:
      tokens - the edge tokens
      Returns:
      a route of the given edge tokens
    • then

      public Route then(Route other)
      Returns this route composed in series with other. The union of the two edge sets — the ⊗ witness of composing two hops. Commutative and associative (set union); either operand being ε returns the other.
      Parameters:
      other - the route to compose with; never null
      Returns:
      this route composed in series with other
    • compareTo

      public int compareTo(Route other)
      Orders routes by edge count, then lexicographically by token — a total order, so the cheapest-route semiring's route-set capping is deterministic.
      Specified by:
      compareTo in interface Comparable<Route>
    • toString

      public String toString()
      Returns the route rendered as t1·t2·t3 (sorted), or ε when empty.
      Specified by:
      toString in class Record
      Returns:
      the route rendered as t1·t2·t3 (sorted), or ε when empty
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • edges

      public List<String> edges()
      Returns the value of the edges record component.
      Returns:
      the value of the edges record component