TupleStream

com.phasmidsoftware.lascala.parser.TupleStream
See theTupleStream companion object
case class TupleStream[X <: Product](parser: CsvParser, input: Stream[String], givenHeader: Header, allowPartial: Boolean = ...) extends TupleStreamBase[X]

Case class which implements ProductStream where the header and tuples are specified indirectly, by providing a parser and Stream[String] such that the element types of the resulting tuples will be Strings.

Type parameters

X

a Tuple which should correspond with the number of values (all types of the tuple should be String).

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class TupleStreamBase[X]
trait ProductStream[X]
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def column(key: String): Option[Stream[String]]

method to project ("slice") a ProductStream into a single column

method to project ("slice") a ProductStream into a single column

Value parameters

key

the name of the column

Attributes

Returns

an Option of Stream[String]

def column(i: Int): Option[Stream[String]]

method to project ("slice") a ProductStream into a single column

method to project ("slice") a ProductStream into a single column

Value parameters

i

the index of the column (0 on the left, n-1 on the right)

Attributes

Returns

an Option of Stream[String]

def getStream: Stream[String]
def header: Header

Attributes

Returns

a sequence of String corresponding to the column names (left to right)

def tuples: Stream[X]

Attributes

Returns

a Stream of tuples

def tuplesPartial(allowPartial: Boolean = ...): Stream[X]

Inherited methods

def asMaps: Try[Stream[Map[String, Scalar]]]

Method asMaps converts this ProductStream into a Stream of Map[String,Scalar] objects, one per row. The keys for the map are derived from the header and the values from the tuple elements.

Method asMaps converts this ProductStream into a Stream of Map[String,Scalar] objects, one per row. The keys for the map are derived from the header and the values from the tuple elements.

Attributes

Returns

a Stream of Map[String,Scalar] objects

Inherited from:
ProductStreamBase
override def carper(s: String): Unit

Default carper. Normally, programmers should override this with a call to a logger

Default carper. Normally, programmers should override this with a call to a logger

Value parameters

s

the String to carp about

Attributes

Definition Classes
Inherited from:
ProductStreamBase
def filter(p: X => Boolean): ProductStream[X]

filter method

filter method

Value parameters

p

predicate to be applied to each tuple

Attributes

Returns

a product stream which contains all of the elements from this that satisfy the predicate

Inherited from:
ProductStream
def flatMap[Y <: Product](f: X => IterableOnce[Y]): ProductStream[Y]

flatMap method

flatMap method

Value parameters

f

function to be applied to each tuple

Attributes

Returns

a ProductStream of transformed tuples

Inherited from:
ProductStream
def get(i: Int): Option[X]

Value parameters

i

get the ith row as a tuple

Attributes

Returns

Some(tuple) if i is valid, else None

Inherited from:
ProductStream
def getHeader(givenHeader: Header): Header

May print to the SysErr stream as a side-effect if wsy is a Failure

May print to the SysErr stream as a side-effect if wsy is a Failure

Attributes

Returns

the header for this object

Inherited from:
TupleStreamBase
def map[Y <: Product](f: X => Y): ProductStream[Y]

map method

map method

Value parameters

f

function to be applied to each tuple

Attributes

Returns

a ProductStream of transformed tuples

Inherited from:
ProductStream
def productElementNames: Iterator[String]

An iterator over the names of all the elements of this product.

An iterator over the names of all the elements of this product.

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

An iterator over all the elements of this product.

An iterator over all the elements of this product.

Attributes

Returns

in the default implementation, an Iterator[Any]

Inherited from:
Product
def stringToTuple(f: String => Try[Scalar], allowPartial: Boolean = ...)(s: String): Try[X]

Value parameters

f

the function which will be applied to a String to yield an Any (an element of a Tuple)

s

the (row/line) String to be parsed

Attributes

Returns

a Option[X]

Inherited from:
TupleStreamBase
def toMap[K](pk: X => K): Map[K, X]

toMap method

toMap method

Value parameters

pk

function to yield a primary key value from a tuple

Attributes

Returns

a Map where each element is of form pk->tuple

Inherited from:
ProductStream

Inherited fields

lazy val asList: List[X]

Attributes

Returns

a materialized (non-lazy) List version of the tuples.

Inherited from:
ProductStream
lazy protected val wsy: Try[Seq[String]]

Attributes

Inherited from:
TupleStreamBase