Package dap4.servlet
Class Generator
- java.lang.Object
-
- dap4.servlet.DapSerializer
-
- dap4.servlet.Generator
-
public class Generator extends DapSerializer
Given a DMR, return: 1. A byte array (byte[]) containing serialized data and (optionally) the DMRRequirements: 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.
-
-
Field Summary
Fields Modifier and Type Field Description protected static booleanasciionlyprotected ChunkWritercwprotected dap4.core.dmr.DapDatasetdmrprotected ByteArrayOutputStreamstreamprotected Valuevaluesprotected booleanwithdmr-
Fields inherited from class dap4.servlet.DapSerializer
ce, checksummode, dsp, order, writer
-
-
Constructor Summary
Constructors Constructor Description Generator(dap4.core.dmr.DapDataset dmr, Value.ValueSource src)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidatomicVariable(dap4.core.dmr.DapVariable dapvar)voidbegin(dap4.core.ce.CEConstraint ce, ChunkWriter cw, boolean withdmr, dap4.core.data.ChecksumMode mode)voiddataset(dap4.core.dmr.DapDataset dmr)voidend()voidgenerate(dap4.core.ce.CEConstraint ce, ChunkWriter cw, boolean withdmr, dap4.core.data.ChecksumMode mode)voidgenerateDMR(dap4.core.dmr.DapDataset dmr)static intgetRowCount()voidsequenceVariable(dap4.core.dmr.DapVariable var)static voidsetASCII(boolean tf)static voidsetRowCount(int count)protected Stringstringify(Object v)voidstructureVariable(dap4.core.dmr.DapVariable var)voidvariable(dap4.core.dmr.DapVariable dapvar)-
Methods inherited from class dap4.servlet.DapSerializer
write, writeAtomicVariable, writeRecord, writeSequence, writeSequence1, writeStructure, writeStructure1, writeVariable
-
-
-
-
Field Detail
-
asciionly
protected static boolean asciionly
-
values
protected Value values
-
stream
protected ByteArrayOutputStream stream
-
cw
protected ChunkWriter cw
-
withdmr
protected boolean withdmr
-
dmr
protected dap4.core.dmr.DapDataset dmr
-
-
Constructor Detail
-
Generator
public Generator(dap4.core.dmr.DapDataset dmr, Value.ValueSource src) throws dap4.core.util.DapException- Throws:
dap4.core.util.DapException
-
-
Method Detail
-
setASCII
public static void setASCII(boolean tf)
-
getRowCount
public static int getRowCount()
-
setRowCount
public static void setRowCount(int count)
-
generate
public void generate(dap4.core.ce.CEConstraint ce, ChunkWriter cw, boolean withdmr, dap4.core.data.ChecksumMode mode) throws dap4.core.util.DapException- Throws:
dap4.core.util.DapException
-
begin
public void begin(dap4.core.ce.CEConstraint ce, ChunkWriter cw, boolean withdmr, dap4.core.data.ChecksumMode mode) throws dap4.core.util.DapException- Throws:
dap4.core.util.DapException
-
end
public void end() throws dap4.core.util.DapException- Throws:
dap4.core.util.DapException
-
generateDMR
public void generateDMR(dap4.core.dmr.DapDataset dmr) throws dap4.core.util.DapException- Throws:
dap4.core.util.DapException
-
dataset
public void dataset(dap4.core.dmr.DapDataset dmr) throws dap4.core.util.DapException- Throws:
dap4.core.util.DapException
-
variable
public void variable(dap4.core.dmr.DapVariable dapvar) throws dap4.core.util.DapException- Throws:
dap4.core.util.DapException
-
atomicVariable
public void atomicVariable(dap4.core.dmr.DapVariable dapvar) throws dap4.core.util.DapException- Throws:
dap4.core.util.DapException
-
structureVariable
public void structureVariable(dap4.core.dmr.DapVariable var) throws dap4.core.util.DapException- Throws:
dap4.core.util.DapException
-
sequenceVariable
public void sequenceVariable(dap4.core.dmr.DapVariable var) throws dap4.core.util.DapException- Throws:
dap4.core.util.DapException
-
-