drasys.or.matrix
Class SMFReader
java.lang.Object
|
+--java.io.Reader
|
+--java.io.BufferedReader
|
+--drasys.or.matrix.SMFReader
- public class SMFReader
- extends java.io.BufferedReader
- implements MatrixReaderI
Inputs matrices from an
SMF
stream.
Fields inherited from class java.io.Reader |
lock |
Method Summary |
int |
readMatrix(MatrixI matrix)
Reads a matrix from the stream in the
SMF
format. |
int |
readMatrix(SizableMatrixI matrix,
boolean resize)
Reads a matrix from the stream in the
SMF
format. |
void |
setIgnoreInvalid(boolean ignore)
If 'ignore' is 'true' then any elements with invalid indices will be ignored. |
Methods inherited from class java.io.BufferedReader |
close,
mark,
markSupported,
read,
read,
readLine,
ready,
reset,
skip |
Methods inherited from class java.io.Reader |
read |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
SMFReader
public SMFReader(java.io.Reader in)
SMFReader
public SMFReader(java.io.Reader in,
int sz)
setIgnoreInvalid
public void setIgnoreInvalid(boolean ignore)
- If 'ignore' is 'true' then any elements with invalid indices will be ignored.
If 'ignore' is 'false' then an InvalidArrayIndexException will be thrown for elements with invalid indices.
The default is to throw an exception for invalid elements.
- Specified by:
- setIgnoreInvalid in interface MatrixReaderI
readMatrix
public int readMatrix(MatrixI matrix)
throws java.io.IOException
- Reads a matrix from the stream in the
SMF
format.
Any elements in the matrix not appearing in the input stream will remain unchanged.
The size record is used to make sure the input matrix will fit in the container matrix.
- Specified by:
- readMatrix in interface MatrixReaderI
- Returns:
- the number of elements read from the stream.
- Throws:
- java.lang.ArrayIndexOutOfBoundsException - if the input matrix size or
an element's index is invalid for the container matrix size.
readMatrix
public int readMatrix(SizableMatrixI matrix,
boolean resize)
throws java.io.IOException
- Reads a matrix from the stream in the
SMF
format.
Any elements in the matrix not appearing in the input stream will remain unchanged.
The size record is used to set the size of the container matrix if 'resize' is 'true'.
- Specified by:
- readMatrix in interface MatrixReaderI
- Returns:
- the number of elements read from the stream.
- Throws:
- java.lang.ArrayIndexOutOfBoundsException - if the input matrix size or
an element's index is invalid for the container matrix size.
Copyright(C)1997-2000 by DRA Systems all rights reserved. OpsResearch.com