Package dap4.dap4lib
Class DSPPrinter
- java.lang.Object
-
- dap4.dap4lib.DSPPrinter
-
public class DSPPrinter extends Object
DAP DSP Printer. Given a constraint and a DSP print the constrained subset of the data in text form.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDSPPrinter.Flags
-
Field Summary
Fields Modifier and Type Field Description protected dap4.core.ce.CEConstraintceprotected static intCOLUMNSprotected dap4.core.data.DSPdspprotected EnumSet<DSPPrinter.Flags>flagsprotected static charLBRACEprotected static charLBRACKETprotected static charLPARENprotected static intNILFLAGSprotected static intNONAMEprotected static intNONNILprotected static intPERLINEprotected dap4.core.util.IndentWriterprinterprotected static charRBRACEprotected static charRBRACKETprotected static charRPARENprotected PrintWriterwriter
-
Constructor Summary
Constructors Modifier Constructor Description protectedDSPPrinter()DSPPrinter(dap4.core.data.DSP dsp, dap4.core.ce.CEConstraint ce, Writer writer)DSPPrinter(dap4.core.data.DSP dsp, Writer writer)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description DSPPrinterclose()DSPPrinterflag(DSPPrinter.Flags flag)DSPPrinterflush()protected static StringgetPrintValue(Object value)protected static charhexchar(int i)protected StringindicesToString(dap4.core.util.Index indices)DSPPrinterprint()Print data from a DSP - optionally constrainedprotected voidprintArray(dap4.core.data.DataCursor data, List<dap4.core.util.Slice> slices)protected voidprintAtomicInstance(dap4.core.data.DataCursor datav, dap4.core.util.Index pos)protected voidprintAtomicVector(dap4.core.data.DataCursor data, List<dap4.core.util.Slice> slices, dap4.core.util.Odometer odom)protected voidprintCompoundInstance(dap4.core.data.DataCursor datav)Print a single structure or sequence or record instanceprotected voidprintScalar(dap4.core.data.DataCursor data)protected voidprintVariable(dap4.core.data.DataCursor data, List<dap4.core.util.Slice> slices)Print an arbitrary DataVariable using a constraint.protected StringvalueString(Object vector, long pos, dap4.core.dmr.DapType basetype)
-
-
-
Field Detail
-
COLUMNS
protected static final int COLUMNS
- See Also:
- Constant Field Values
-
LPAREN
protected static final char LPAREN
- See Also:
- Constant Field Values
-
RPAREN
protected static final char RPAREN
- See Also:
- Constant Field Values
-
LBRACE
protected static final char LBRACE
- See Also:
- Constant Field Values
-
RBRACE
protected static final char RBRACE
- See Also:
- Constant Field Values
-
LBRACKET
protected static final char LBRACKET
- See Also:
- Constant Field Values
-
RBRACKET
protected static final char RBRACKET
- See Also:
- Constant Field Values
-
NILFLAGS
protected static final int NILFLAGS
- See Also:
- Constant Field Values
-
PERLINE
protected static final int PERLINE
- See Also:
- Constant Field Values
-
NONAME
protected static final int NONAME
- See Also:
- Constant Field Values
-
NONNIL
protected static final int NONNIL
- See Also:
- Constant Field Values
-
writer
protected PrintWriter writer
-
printer
protected dap4.core.util.IndentWriter printer
-
dsp
protected dap4.core.data.DSP dsp
-
ce
protected dap4.core.ce.CEConstraint ce
-
flags
protected EnumSet<DSPPrinter.Flags> flags
-
-
Method Detail
-
flag
public DSPPrinter flag(DSPPrinter.Flags flag)
-
flush
public DSPPrinter flush()
-
close
public DSPPrinter close()
-
print
public DSPPrinter print() throws dap4.core.util.DapException
Print data from a DSP - optionally constrained- Throws:
dap4.core.util.DapException
-
printVariable
protected void printVariable(dap4.core.data.DataCursor data, List<dap4.core.util.Slice> slices) throws dap4.core.util.DapExceptionPrint an arbitrary DataVariable using a constraint.Handling newlines is a bit tricky so the rule is that the last newline is elided and left for the caller to print. Exceptions: ?
- Parameters:
data- - the cursor to print- Throws:
dap4.core.util.DapException- Note that the PrintWriter and CEConstraint are global.
-
printScalar
protected void printScalar(dap4.core.data.DataCursor data) throws dap4.core.util.DapException- Throws:
dap4.core.util.DapException
-
printArray
protected void printArray(dap4.core.data.DataCursor data, List<dap4.core.util.Slice> slices) throws dap4.core.util.DapException- Throws:
dap4.core.util.DapException
-
printAtomicVector
protected void printAtomicVector(dap4.core.data.DataCursor data, List<dap4.core.util.Slice> slices, dap4.core.util.Odometer odom) throws dap4.core.util.DapException- Throws:
dap4.core.util.DapException
-
printAtomicInstance
protected void printAtomicInstance(dap4.core.data.DataCursor datav, dap4.core.util.Index pos) throws dap4.core.util.DapException- Throws:
dap4.core.util.DapException
-
printCompoundInstance
protected void printCompoundInstance(dap4.core.data.DataCursor datav) throws dap4.core.util.DapExceptionPrint a single structure or sequence or record instance- Parameters:
datav-- Throws:
dap4.core.util.DapException
-
indicesToString
protected String indicesToString(dap4.core.util.Index indices) throws dap4.core.util.DapException
- Throws:
dap4.core.util.DapException
-
valueString
protected String valueString(Object vector, long pos, dap4.core.dmr.DapType basetype) throws dap4.core.util.DapException
- Throws:
dap4.core.util.DapException
-
hexchar
protected static char hexchar(int i)
-
-