scalax.data.collection.Tree

class Tree

[source: scalax/data/collection/Tree.scala]

abstract class Tree[a]
extends AnyRef
A simple tree class where each node (Tree) is a Leaf or a Branch, and each Branch contains a list of other Trees.
Direct Known Subclasses:
collection.Tree.Branch, collection.Tree.Leaf

Method Summary
def flatten : scala.Stream[a]
Flatten the leaves into a single stream.
def get (path : scala.Seq[Int]) : a
Access a node via the given index path.
def show (showLeaf : (a) => java.lang.String) : java.lang.String
Show the tree as a string.
Methods inherited from AnyRef
getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Method Details
def show(showLeaf : (a) => java.lang.String) : java.lang.String
Show the tree as a string.

Leaf("a") ->

a

Branch(List(Leaf("a"), Leaf("b"))) ->

a

b

Branch(List(Leaf("a"), Branch(List(Leaf("b"), Leaf("c"))), Leaf("d")))

->

a

b

c

d


def get(path : scala.Seq[Int]) : a
Access a node via the given index path.

def flatten : scala.Stream[a]
Flatten the leaves into a single stream.


Copyright (c) 2005-8 The Scalax Project. All Rights Reserved.