public class MojoFrameBuilder
extends java.lang.Object
The builder is used for constructing a MojoFrame. A frame is constructed by the following procedure:
1. Get a MojoRowBuilder instance from the frame builder 2. Construct a row from the MojoRowBuilder 3. Append the resulting row to the frame builder 4. Repeat steps 1-3 until all rows are constructed 5. Construct the MojoFrame
See MojoRowBuilder
| Modifier and Type | Field and Description |
|---|---|
static StringConverter |
DEFAULT_CONVERTER |
| Constructor and Description |
|---|
MojoFrameBuilder(MojoFrameMeta frameMeta)
Constructor for a MojoFrameBuilder.
|
MojoFrameBuilder(MojoFrameMeta frameMeta,
java.util.Collection<java.lang.String> missingValues,
java.util.Map<java.lang.String,StringConverter> stringConverters)
Constructor for a MojoFrameBuilder.
|
MojoFrameBuilder(MojoFrameMeta frameMeta,
java.util.Set<java.lang.String> missingValues)
Constructor for a MojoFrameBuilder.
|
| Modifier and Type | Method and Description |
|---|---|
MojoRowBuilder |
addRow(MojoRowBuilder rowBuilder)
Append a row from the current state of a MojoRowBuilder.
|
static MojoFrame |
fromColumns(MojoFrameMeta meta,
MojoColumn[] columns)
Create a MojoFrame from an array of MojoColumns as specified by the provided meta data.
|
static MojoFrame |
getEmpty(MojoFrameMeta meta,
int nrows)
Create a MojoFrame with
nrows rows based on the meta data provided. |
MojoRowBuilder |
getMojoRowBuilder()
Get an instance of a MojoRowBuilder that can be used to construct a row for this builder.
|
MojoRowBuilder |
getMojoRowBuilder(boolean strictMode)
Get an instance of a MojoRowBuilder that can be used to construct a row for this builder.
|
MojoFrame |
toMojoFrame()
Create a MojoFrame from the current state of this builder
|
MojoFrame |
toMojoFrame(int nrows) |
static MojoFrameBuilder |
withSharedColumns(MojoFrameMeta frameMeta,
MojoFrameBuilder shared)
Use when you need some output columns to just expose input columns.
|
public static final StringConverter DEFAULT_CONVERTER
public MojoFrameBuilder(MojoFrameMeta frameMeta)
Constructor for a MojoFrameBuilder.
frameMeta - The meta data for the resulting frame (see MojoFrameMeta)public MojoFrameBuilder(MojoFrameMeta frameMeta, java.util.Set<java.lang.String> missingValues)
Constructor for a MojoFrameBuilder.
frameMeta - The meta data for the resulting frame (see MojoFrameMeta)missingValues - List of string values which are interpreted as missing value.public MojoFrameBuilder(MojoFrameMeta frameMeta, java.util.Collection<java.lang.String> missingValues, java.util.Map<java.lang.String,StringConverter> stringConverters)
Constructor for a MojoFrameBuilder.
frameMeta - The meta data for the resulting frame (see MojoFrameMeta)missingValues - List of string values which are interpreted as missing value.stringConverters - A Map that associates column names to their respective StringConverter. DEFAULT_CONVERTER is used if a column’s name is not found in the Mappublic static MojoFrameBuilder withSharedColumns(MojoFrameMeta frameMeta, MojoFrameBuilder shared)
Use when you need some output columns to just expose input columns.
frameMeta - output columns descriptorshared - the input frame builder to use for matching columns (= same name and type)public static MojoFrame getEmpty(MojoFrameMeta meta, int nrows)
Create a MojoFrame with nrows rows based on the meta data provided. The values in this frame will all be NA.
meta - The meta data of the frame to be constructednrows - The number of rowspublic static MojoFrame fromColumns(MojoFrameMeta meta, MojoColumn[] columns)
Create a MojoFrame from an array of MojoColumns as specified by the provided meta data.
meta - The meta data to be used as a templatecolumns - The columns to be used in the resulting framepublic MojoRowBuilder addRow(MojoRowBuilder rowBuilder)
Append a row from the current state of a MojoRowBuilder. The MojoRowBuilder will subsequently be reset.
rowBuilder - The MojoRowBuilder containing the row to be constructed and appendedpublic MojoRowBuilder getMojoRowBuilder()
Get an instance of a MojoRowBuilder that can be used to construct a row for this builder. Each call to this method creates a new MojoRowBuilder instance
public MojoRowBuilder getMojoRowBuilder(boolean strictMode)
Get an instance of a MojoRowBuilder that can be used to construct a row for this builder. Each call to this method creates a new MojoRowBuilder instance
strictMode - flag to determine if the created MojoRowBuilder should be in “strict” mode (see MojoRowBuilder).public MojoFrame toMojoFrame()
Create a MojoFrame from the current state of this builder
public MojoFrame toMojoFrame(int nrows)