Package ptolemy.data.expr
Class MatrixParser
- java.lang.Object
-
- ptolemy.data.expr.MatrixParser
-
- All Implemented Interfaces:
MatrixParserConstants
,MatrixParserTreeConstants
public class MatrixParser extends java.lang.Object implements MatrixParserTreeConstants, MatrixParserConstants
This Class provides a parser for read matrices in matlab format.- Since:
- Ptolemy II 1.0
- Version:
- $Id$
- Author:
- Bart Kienhuis
- Pt.AcceptedRating:
- Red (kienhuis)
- Pt.ProposedRating:
- Red
-
-
Field Summary
Fields Modifier and Type Field Description Token
jj_nt
Next token.protected JJTMatrixParserState
jjtree
Token
token
Current token.MatrixParserTokenManager
token_source
Generated Token Manager.-
Fields inherited from interface ptolemy.data.expr.MatrixParserConstants
COMMENT, CONSTANT, DEFAULT, DIGIT, EOF, FLOAT, INTEGER, NAME, NATURAL, SIGN, tokenImage
-
Fields inherited from interface ptolemy.data.expr.MatrixParserTreeConstants
JJTELEMENT, JJTMATRIX, jjtNodeName, JJTROW
-
-
Constructor Summary
Constructors Constructor Description MatrixParser(java.io.InputStream stream)
Constructor with InputStream.MatrixParser(java.io.InputStream stream, java.lang.String encoding)
Constructor with InputStream and supplied encodingMatrixParser(java.io.Reader stream)
Constructor.MatrixParser(MatrixParserTokenManager tm)
Constructor with generated Token Manager.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
disable_tracing()
Disable tracing.double
element()
void
enable_tracing()
Enable tracing.ParseException
generateParseException()
Generate ParseException.Token
getNextToken()
Get the next Token.Token
getToken(int index)
Get the specific Token.java.util.Vector
matrix()
java.util.Vector
readMatrix()
Read a Matrix from File.void
ReInit(java.io.InputStream stream)
Reinitialise.void
ReInit(java.io.InputStream stream, java.lang.String encoding)
Reinitialise.void
ReInit(java.io.Reader stream)
Reinitialise.void
ReInit(MatrixParserTokenManager tm)
Reinitialise.java.util.Vector
row()
-
-
-
Field Detail
-
jjtree
protected JJTMatrixParserState jjtree
-
token_source
public MatrixParserTokenManager token_source
Generated Token Manager.
-
token
public Token token
Current token.
-
jj_nt
public Token jj_nt
Next token.
-
-
Constructor Detail
-
MatrixParser
public MatrixParser(java.io.InputStream stream)
Constructor with InputStream.
-
MatrixParser
public MatrixParser(java.io.InputStream stream, java.lang.String encoding)
Constructor with InputStream and supplied encoding
-
MatrixParser
public MatrixParser(java.io.Reader stream)
Constructor.
-
MatrixParser
public MatrixParser(MatrixParserTokenManager tm)
Constructor with generated Token Manager.
-
-
Method Detail
-
readMatrix
public java.util.Vector readMatrix() throws IllegalActionException
Read a Matrix from File.- Returns:
- A Vector containing the contents of the file.
- Throws:
IllegalActionException
- If an error occurs during parsing.
-
matrix
public final java.util.Vector matrix() throws ParseException
- Throws:
ParseException
-
row
public final java.util.Vector row() throws ParseException
- Throws:
ParseException
-
element
public final double element() throws ParseException
- Throws:
ParseException
-
ReInit
public void ReInit(java.io.InputStream stream)
Reinitialise.
-
ReInit
public void ReInit(java.io.InputStream stream, java.lang.String encoding)
Reinitialise.
-
ReInit
public void ReInit(java.io.Reader stream)
Reinitialise.
-
ReInit
public void ReInit(MatrixParserTokenManager tm)
Reinitialise.
-
getNextToken
public final Token getNextToken()
Get the next Token.
-
getToken
public final Token getToken(int index)
Get the specific Token.
-
generateParseException
public ParseException generateParseException()
Generate ParseException.
-
enable_tracing
public final void enable_tracing()
Enable tracing.
-
disable_tracing
public final void disable_tracing()
Disable tracing.
-
-