Record Class Route
java.lang.Object
java.lang.Record
com.darkcollective.relix.provenance.Route
- Record Components:
edges- the canonical (sorted, de-duplicated) edge tokens; nevernull(empty =ε)
- All Implemented Interfaces:
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 -
Method Summary
Modifier and TypeMethodDescriptionintOrders routes by edge count, then lexicographically by token — a total order, so the cheapest-route semiring's route-set capping is deterministic.edges()Returns the value of theedgesrecord component.static Routeempty()Returns the empty routeε.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.static RouteReturns a route of the given edge tokens.Returns this route composed in series withother.toString()Returns the route rendered ast1·t2·t3(sorted), orεwhen empty.
-
Constructor Details
-
Route
Canonicalisesedgesinto 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; nevernull, no null element
-
-
Method Details
-
empty
Returns the empty routeε. The witness of the free derivation.- Returns:
- the empty route
ε
-
of
Returns a route of the given edge tokens.- Parameters:
tokens- the edge tokens- Returns:
- a route of the given edge tokens
-
then
Returns this route composed in series withother. 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; nevernull- Returns:
- this route composed in series with
other
-
compareTo
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:
compareToin interfaceComparable<Route>
-
toString
Returns the route rendered ast1·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. -
equals
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 withObjects::equals(Object,Object). -
edges
Returns the value of theedgesrecord component.- Returns:
- the value of the
edgesrecord component
-