public class MojoFrameBuilder
extends java.lang.Object
The builder is used for constructing a MojoFrame
. A frame is constructed by the following procedure:
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)
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.
|
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 |
fromFrames(MojoFrameMeta meta,
MojoFrame... frames)
Create a MojoFrame in accordance to a
MojoFrameMeta by concatenating a series of existing MojoFrames. |
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
|
public static final StringConverter DEFAULT_CONVERTER
public MojoFrameBuilder(MojoFrameMeta frameMeta, java.util.Collection<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 Map
public MojoFrameBuilder(MojoFrameMeta frameMeta)
Constructor for a MojoFrameBuilder.
frameMeta
- The meta data for the resulting frame (see MojoFrameMeta
)public 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 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 fromFrames(MojoFrameMeta meta, MojoFrame... frames)
Create a MojoFrame in accordance to a MojoFrameMeta
by concatenating a series of existing MojoFrames. This means that columns are added to the return frame based on position and not by name. The total number of columns across all of the argument frames must match the size of the meta data, and each argument frame must have the same number of rows. The resulting frame contains references to the same column instances
meta
- The meta data to use as a template for the return frameframes
- The frame(s) to be used to construct the return framepublic 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 frame