Class to represent the rows of a Table.
The rows are kept in a Vector, in order (as of 2.0; in 1.x, they were a ParIterable, in no particular order). For parallel processing, use par. The internal representation may change; thus xs is private.
In general, however, you should probably expect that storing rows inside Content will force an aggregation of all rows. There are alternatives (using InputProcessor) that allow you to process an Iterator[Input] and yield an Iterator[Row].
Type parameters
- Row
-
the underlying Row type.
Value parameters
- xs
-
a Vector[Row].
Attributes
- Companion
- object
- Graph
-
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Members list
Value members
Concrete methods
Method to concatenate two Contents. CONSIDER perhaps we should use the combiner functionality more directly? (It's what the ++ method uses).
Method to concatenate two Contents. CONSIDER perhaps we should use the combiner functionality more directly? (It's what the ++ method uses).
Type parameters
- B
-
the underlying type of the other Content and the result. Must be a super-type of Row.
Value parameters
- other
-
the other Content.
Attributes
- Returns
-
Content[B].
Drops the first n elements from the underlying collection xs and returns a new Content instance containing the remaining elements.
Drops the first n elements from the underlying collection xs and returns a new Content instance containing the remaining elements.
The method does not modify the original collection but instead creates a new Content instance with the result of the drop operation applied to xs.
Value parameters
- n
-
the number of elements to drop from the start of the collection. If
nis greater than the size of the collection, an emptyContentis returned.
Attributes
- Returns
-
a new
Content[Row]containing the elements of the collection after dropping the firstnelements.
Drops elements from this Content[Row] collection as long as the given predicate p evaluates to true, and returns the remaining elements wrapped in a new Content.
Drops elements from this Content[Row] collection as long as the given predicate p evaluates to true, and returns the remaining elements wrapped in a new Content.
The elements are checked in their order, and once the predicate returns false for the first time, no further elements are dropped, and the remaining elements are included in the resulting Content.
Value parameters
- p
-
a predicate function of type
Row => Boolean. This function determines whether an element should be dropped. Elements for which the predicate returns true are removed from the start of the collection.
Attributes
- Returns
-
a new
Content[Row]containing the elements of thisContentafter all leading elements satisfying the predicatephave been removed.
Filters the rows in this content based on the given predicate.
Filters the rows in this content based on the given predicate.
Value parameters
- p
-
a predicate function that determines whether a given Row should be included in the resulting Content. The function should return true for rows that should be included and false otherwise.
Attributes
- Returns
-
a new Content[Row] containing only the rows from this content that satisfy the given predicate.
Filters the rows of this Content[Row] by removing those that satisfy the given predicate function.
Filters the rows of this Content[Row] by removing those that satisfy the given predicate function.
Value parameters
- p
-
the predicate function that determines whether a
Rowshould be excluded. Rows for which this function evaluates to true will be excluded from the resultingContent.
Attributes
- Returns
-
a new
Content[Row]containing only the rows that do not satisfy the given predicate function.
This is not, strictly speaking, the correct definition of flatMap for allowing Content to be a monad.
This is not, strictly speaking, the correct definition of flatMap for allowing Content to be a monad.
Type parameters
- B
-
the underlying type of the result.
Value parameters
- f
-
a function of type Row=>IterableOnce[B]
Attributes
- Returns
-
a Content[B].
Applies a binary operator to a start value and all elements of the underlying collection xs, going left to right, and returns a reduced value.
Applies a binary operator to a start value and all elements of the underlying collection xs, going left to right, and returns a reduced value.
This method performs a fold operation, where the initial value is provided by z and the binary operator op is applied successively to combine elements of the collection with the accumulated result.
Value parameters
- op
-
A binary operator function that takes the current accumulated result and the next element of the collection, returning a new accumulated result. The function has the type
(B, Row) => B, whereBis the type of the accumulated result, andRowrepresents elements of the collection. - z
-
The initial value of the fold operation.
Attributes
- Returns
-
The result of applying the fold operation over all elements of the collection. The result type is
B.
Applies the given function f to each Row element in the collection.
Applies the given function f to each Row element in the collection.
This method iterates over all elements in the underlying sequence xs and applies the specified function f to each of them.
Value parameters
- f
-
a function of type
Row => Unitthat is applied to each row in the collection. The function is invoked for its side effects on each element.
Attributes
- Returns
-
Unitas this method is intended for side-effectful operations.
This should be used only by unit tests and not by code.
This should be used only by unit tests and not by code.
Attributes
- Returns
-
the first element of xs.
Provides an iterator to traverse the rows in this content. NOTE: do not expect an iterator on Content to be in any particular order.
Provides an iterator to traverse the rows in this content. NOTE: do not expect an iterator on Content to be in any particular order.
Attributes
- Returns
-
an
Iteratorover theRowelements of this content in their current order.
Returns the known size of the collection underlying this Content instance. If the size is known, the method will return the exact size. Otherwise, it will return -1.
Returns the known size of the collection underlying this Content instance. If the size is known, the method will return the exact size. Otherwise, it will return -1.
Attributes
- Returns
-
the known size of the collection, or -1 if the size cannot be determined.
Transforms each element in the current Content collection using the given function f.
Transforms each element in the current Content collection using the given function f.
Value parameters
- f
-
A function that takes an element of type
Rowand produces a new element of typeB.
Attributes
- Returns
-
A new
Contentinstance containing the transformed elements of typeB.
Transform (flatMap) this Table[Row] into a Table[S].
Transform (flatMap) this Table[Row] into a Table[S].
Type parameters
- S
-
the type of the rows of the result.
Value parameters
- f
-
a function which transforms a Row into an IterableOnce[S].
Attributes
- Returns
-
a Table[S] which is made up of a concatenation of the results of invoking f on each row this
Method to get the rows as a parallel collection, for parallel processing. (As of 2.0, the other methods of Content are sequential.)
Method to get the rows as a parallel collection, for parallel processing. (As of 2.0, the other methods of Content are sequential.)
Attributes
- Returns
-
a ParIterable[Row].
Method to randomly sample from this Content.
Method to randomly sample from this Content.
Value parameters
- n
-
the odds against choosing any particular element.
- random
-
an (implicit) Random number generator.
Attributes
- Returns
-
a new Content[Row] with approximately size/n elements.
Method to get the number of elements in the underlying collection xs.
Method to get the number of elements in the underlying collection xs.
Attributes
- Returns
-
the size of the collection as an integer.
Produces a slice of the content by extracting elements within the specified range.
Produces a slice of the content by extracting elements within the specified range.
This method creates a new Content[Row] that contains elements from index from (inclusive) to index until (exclusive) of the underlying collection xs. If the range specified by from and until exceeds the bounds of the underlying collection, the slicing will silently handle it and only include the valid indices.
Value parameters
- from
-
the starting index (inclusive) of the slice.
- until
-
the ending index (exclusive) of the slice.
Attributes
- Returns
-
a new
Content[Row]containing the elements in the specified range.
Method to transform this Content[Row] into a sorted Content[S] where S is a super-class of Row and for which there is evidence of Ordering[S].
Method to transform this Content[Row] into a sorted Content[S] where S is a super-class of Row and for which there is evidence of Ordering[S].
Type parameters
- S
-
the underlying type of the resulting Table (a super-type of Row and for which there is evidence of Ordering[S]).
Attributes
- Returns
-
a Content[S].
Returns a new Content[Row] containing the first n elements from the current Content[Row].
Returns a new Content[Row] containing the first n elements from the current Content[Row].
If n is greater than the size of the underlying collection, all elements from the collection will be included in the returned Content[Row]. If n is less than or equal to zero, the result will be an empty Content[Row].
Value parameters
- n
-
the number of elements to take from the beginning of the underlying collection. Must be a non-negative integer.
Attributes
- Returns
-
a new
Content[Row]containing up to the firstnelements from the current content.
Selects elements from the beginning of the underlying collection of rows, as long as they satisfy the specified predicate. The operation stops as soon as a row is encountered that does not meet the condition.
Selects elements from the beginning of the underlying collection of rows, as long as they satisfy the specified predicate. The operation stops as soon as a row is encountered that does not meet the condition.
Value parameters
- p
-
a predicate function of type
Row => Booleanthat determines whether a row should be included. The function should returntrueto select the row andfalseto stop further selection.
Attributes
- Returns
-
a new
Content[Row]containing the rows from the start of the collection that satisfy the given predicate.
Converts the underlying collection of elements to an array.
Converts the underlying collection of elements to an array.
Type parameters
- B
-
the type of elements in the resulting array. It must be a supertype of
Rowand have an implicitClassTag.
Attributes
- Returns
-
an array containing all elements of the collection.
Converts the content of xs into an IndexedSeq[Row].
Converts the content of xs into an IndexedSeq[Row].
Attributes
- Returns
-
an IndexedSeq containing all elements of
xs.
Converts the underlying collection of rows to a sequence.
Converts the underlying collection of rows to a sequence.
Attributes
- Returns
-
a sequence (Seq[Row]) containing the rows of the content.
Inherited methods
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
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