Folding

com.ossuminc.riddl.language.Folding
object Folding

An object for distinguishing several functions as ways to fold the model

Attributes

Source
Folding.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Folding.type

Members list

Value members

Concrete methods

def foldEachDefinition[S, CV <: ContentValues](container: Container[CV], empty: S)(foldIt: (S, CV) => S): S

Folding with state from an element of type V

Folding with state from an element of type V

Type parameters

CV

The type of the element being folded

S

The type of the state for folding

Value parameters

child

The node to fold through

f

The folding function which takes 3 arguments and returns an S (list the initial state)

parent

The parent node of CV which must be its direct container

state

Initial value of arbitrary type S that can be used to fold the nodes into and provides the result type

Attributes

Returns

The resulting state of type S

Source
Folding.scala
final def foldLeftWithStack[S, CT <: ContentValues](zeroValue: S, top: Container[CT], parents: ParentStack)(f: (S, CT | Container[CT], Parents) => S): S

A Typical foldLeft as with scala.collection.Seq but utilizing a stack of parents as well.

A Typical foldLeft as with scala.collection.Seq but utilizing a stack of parents as well.

Type parameters

CT

The type of nodes to fold over

S

The type of the state

Value parameters

f

The folder function which is passed the state [S], the node or its container, and the list of parents

parents

The parents of the value node

top

The containing top node of value

zeroValue

The "zero" value for the fold, the value at which folding starts

Attributes

Returns

The folded state

See also

scala.collection.Seq.foldLeft

Source
Folding.scala