TraversalLogicExt

overflowdb.traversal.TraversalLogicExt
final class TraversalLogicExt[A](val iterator: Iterator[A]) extends AnyVal

Attributes

Graph
Supertypes
class AnyVal
trait Matchable
class Any

Members list

Concise view

Type members

Types

type Traversal[A] = Iterator[A]

Value members

Concrete methods

def and(traversals: Iterator[A] => Iterator[_]*): Iterator[A]

only preserves elements for which all of the given traversals have at least one result Works for arbitrary amount of 'AND' traversals.

only preserves elements for which all of the given traversals have at least one result Works for arbitrary amount of 'AND' traversals.

Attributes

Example:
.and(_.label("someLabel"), _.has("someProperty"))
def choose[BranchOn >: Null, NewEnd](on: Iterator[A] => Iterator[BranchOn])(options: PartialFunction[BranchOn, Iterator[A] => Iterator[NewEnd]]): Iterator[NewEnd]

Branch step: based on the current element, match on something given a traversal, and provide resulting traversals based on the matched element. Allows to implement conditional semantics: if, if/else, if/elseif, if/elseif/else, ...

Branch step: based on the current element, match on something given a traversal, and provide resulting traversals based on the matched element. Allows to implement conditional semantics: if, if/else, if/elseif, if/elseif/else, ...

Attributes

BranchOn

required to be >: Null because the implementation is using null as the default value. I didn't find a better way to implement all semantics with the niceties of PartialFunction, and also yolo...

NewEnd

The element type of the resulting traversal

on

Traversal to get to what you want to match on

options

PartialFunction from the matched element to the resulting traversal

See also:

LogicalStepsTests

Example:
.choose(_.property(Name)) {
 case "L1" => _.out
 case "R1" => _.repeat(_.out)(_.maxDepth(3))
 case _ => _.in
}
def coalesce[NewEnd](options: Iterator[A] => Iterator[NewEnd]*): Iterator[NewEnd]
def not(trav: Iterator[A] => Iterator[_]): Iterator[A]

only preserves elements if the provided traversal does not have any results - alias for whereNot

only preserves elements if the provided traversal does not have any results - alias for whereNot

Attributes

def or(traversals: Iterator[A] => Iterator[_]*): Iterator[A]

only preserves elements for which at least one of the given traversals has at least one result Works for arbitrary amount of 'OR' traversals.

only preserves elements for which at least one of the given traversals has at least one result Works for arbitrary amount of 'OR' traversals.

Attributes

Example:
.or(_.label("someLabel"), _.has("someProperty"))
def sideEffect(fun: A => ): Iterator[A]

perform side effect without changing the contents of the traversal

perform side effect without changing the contents of the traversal

Attributes

def sideEffectPF(pf: PartialFunction[A, _]): Iterator[A]

perform side effect without changing the contents of the traversal will only apply the partialFunction if it is defined for the given input - analogous to collect

perform side effect without changing the contents of the traversal will only apply the partialFunction if it is defined for the given input - analogous to collect

Attributes

def union[B](traversals: Iterator[A] => Iterator[B]*): Iterator[B]

union step from the current point

union step from the current point

Attributes

traversals

to be executed from here, results are being aggregated/summed/unioned

Example:
.union(_.out, _.in)
def where(trav: Iterator[A] => Iterator[_]): Iterator[A]

only preserves elements if the provided traversal has at least one result

only preserves elements if the provided traversal has at least one result

Attributes

def whereNot(trav: Iterator[A] => Iterator[_]): Iterator[A]

only preserves elements if the provided traversal does not have any results

only preserves elements if the provided traversal does not have any results

Attributes

Concrete fields

val iterator: Iterator[A]