public class Generator extends DapSerializer
Requirements: 1. repeatability: given the same DMR, return the same byte array
Notes: 1. Two options are provided for generating values: a. use of a random number generator with a fixed seed. b. use of a pre-defined sequence of values with repetition when the sequence is exhausted (not yet implemented).
Additionally, provide two options for generating data from a DMR. 1. Automated generation of the data from the whole DMR. 2. Selective generation by starting at some variable in the DMR. This is useful when one wants more detailed control over e.g. the number of tuples in a sequence.
| Modifier and Type | Field and Description |
|---|---|
protected static boolean |
asciionly |
protected ChunkWriter |
cw |
protected dap4.core.dmr.DapDataset |
dmr |
protected java.io.ByteArrayOutputStream |
stream |
protected Value |
values |
protected boolean |
withdmr |
ce, checksummode, dsp, order, writer| Constructor and Description |
|---|
Generator(dap4.core.dmr.DapDataset dmr,
Value.ValueSource src) |
| Modifier and Type | Method and Description |
|---|---|
void |
atomicVariable(dap4.core.dmr.DapVariable dapvar) |
void |
begin(dap4.core.ce.CEConstraint ce,
ChunkWriter cw,
boolean withdmr,
dap4.core.data.ChecksumMode mode) |
void |
dataset(dap4.core.dmr.DapDataset dmr) |
void |
end() |
void |
generate(dap4.core.ce.CEConstraint ce,
ChunkWriter cw,
boolean withdmr,
dap4.core.data.ChecksumMode mode) |
void |
generateDMR(dap4.core.dmr.DapDataset dmr) |
static int |
getRowCount() |
void |
sequenceVariable(dap4.core.dmr.DapVariable var) |
static void |
setASCII(boolean tf) |
static void |
setRowCount(int count) |
protected java.lang.String |
stringify(java.lang.Object v) |
void |
structureVariable(dap4.core.dmr.DapVariable var) |
void |
variable(dap4.core.dmr.DapVariable dapvar) |
write, writeAtomicVariable, writeRecord, writeSequence, writeSequence1, writeStructure, writeStructure1, writeVariableprotected static boolean asciionly
protected Value values
protected java.io.ByteArrayOutputStream stream
protected ChunkWriter cw
protected boolean withdmr
protected dap4.core.dmr.DapDataset dmr
public Generator(dap4.core.dmr.DapDataset dmr,
Value.ValueSource src)
throws dap4.core.util.DapException
dap4.core.util.DapExceptionpublic static void setASCII(boolean tf)
public static int getRowCount()
public static void setRowCount(int count)
public void generate(dap4.core.ce.CEConstraint ce,
ChunkWriter cw,
boolean withdmr,
dap4.core.data.ChecksumMode mode)
throws dap4.core.util.DapException
dap4.core.util.DapExceptionpublic void begin(dap4.core.ce.CEConstraint ce,
ChunkWriter cw,
boolean withdmr,
dap4.core.data.ChecksumMode mode)
throws dap4.core.util.DapException
dap4.core.util.DapExceptionpublic void end()
throws dap4.core.util.DapException
dap4.core.util.DapExceptionpublic void generateDMR(dap4.core.dmr.DapDataset dmr)
throws dap4.core.util.DapException
dap4.core.util.DapExceptionpublic void dataset(dap4.core.dmr.DapDataset dmr)
throws dap4.core.util.DapException
dap4.core.util.DapExceptionpublic void variable(dap4.core.dmr.DapVariable dapvar)
throws dap4.core.util.DapException
dap4.core.util.DapExceptionpublic void atomicVariable(dap4.core.dmr.DapVariable dapvar)
throws dap4.core.util.DapException
dap4.core.util.DapExceptionpublic void structureVariable(dap4.core.dmr.DapVariable var)
throws dap4.core.util.DapException
dap4.core.util.DapExceptionpublic void sequenceVariable(dap4.core.dmr.DapVariable var)
throws dap4.core.util.DapException
dap4.core.util.DapExceptionprotected java.lang.String stringify(java.lang.Object v)