Elements

object Elements

For handling of invertible elements, cf AccessPathAlgebra.md. The general rule is that elements concatenate normally, except for:

Elements(&) ++ Elements() == Elements() Elements() ++ Elements(&) == Elements() Elements(<0>) == Elements() Elements() ++ Elements() == Elements(<i+j>) Elements() ++ Elements() == Elements() Elements() ++ Elements() == Elements() Elements() ++ Elements() == Elements(<?>)

From this, once can see that , * and & are invertible, <?> is idempotent and <0> is a convoluted way of describing and empty sequence of tokens. Nevertheless, we mostly consider * as noninvertible (because it is, in real computers!) and <?> as invertible (because it is in real computers, we just don't know the offset)

Elements get a private constructor. Users should use the no-argument Elements.apply() factory method to get an empty path, and the specific concat operators for building up pathes. The Elements.normalized(iter) factory method serves to build this in bulk.

The unnormalized factory method is more of an escape hatch.

The elements field should never be mutated outside of this file: We compare and hash Elements by their contents, not by identity, and this breaks in case of mutation.

The reason for using a mutable Array instead of an immutable Vector is that this is the lightest weight datastructure for the job.

The reason for making this non-private is simply that it is truly annoying to write wrappers for all possible uses.

Companion:
class
class Object
trait Matchable
class Any

Value members

Concrete methods

def inverted(elems: Iterable[AccessElement]): Elements
def noOvertaint(elems: Iterable[AccessElement]): Boolean
def normalized(elems: IterableOnce[AccessElement]): Elements
def unnormalized(elems: IterableOnce[AccessElement]): Elements

Concrete fields