orgposada.nummethpos.vectorpos
Class ReadMatrixFile

java.lang.Object
  |
  +--orgposada.nummethpos.vectorpos.ReadMatrixFile

public class ReadMatrixFile
extends java.lang.Object

Convertir un archivo de texto en un arreglo de "double". El archivo de texto puede estar en cualquier directorio de la computadora local.

Formato del archivo:

rows columns

a11 a12 ... a1m

...

an1 an2 ... anm

Ejemplo de uso:

2 3

5.0 3.14 0.0

1.0 0.01 -7.0

Version:
1.1, 27/09/2001 (rutas relativas)
Author:
Omar Posada Villarreal

Field Summary
private  double[][] arr
           
private  int columns
           
private  java.lang.String currPath
           
private  java.io.Reader filRead
           
private  int rows
           
private  java.io.StreamTokenizer strTok
           
 
Constructor Summary
ReadMatrixFile(java.lang.String currentPath)
           
 
Method Summary
 java.lang.String example()
          Regresa un ejemplo de uso.
 boolean fileToMatrix(java.lang.String sPathFile)
          Leer un archivo de texto y lo convierte en una matriz rectangular tipo "double".
 int getColumns()
           
private  boolean getDimensions()
          Lee las dimensiones de la matriz desde el archivo.
 double[][] getDoubleArray()
           
private  boolean getElements()
          Parsea el archivo en busca de una matriz bien formada.
 int getRows()
           
private  void openFile(java.lang.String sPathFile)
          Abre la conexion y lee archivo.
 void show()
          Muestra la matriz procesada.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

filRead

private java.io.Reader filRead

strTok

private java.io.StreamTokenizer strTok

currPath

private java.lang.String currPath

rows

private int rows

columns

private int columns

arr

private double[][] arr
Constructor Detail

ReadMatrixFile

public ReadMatrixFile(java.lang.String currentPath)
Method Detail

example

public java.lang.String example()
Regresa un ejemplo de uso.

openFile

private void openFile(java.lang.String sPathFile)
Abre la conexion y lee archivo.

getDimensions

private boolean getDimensions()
Lee las dimensiones de la matriz desde el archivo.

getElements

private boolean getElements()
Parsea el archivo en busca de una matriz bien formada.

getRows

public int getRows()

getColumns

public int getColumns()

getDoubleArray

public double[][] getDoubleArray()

fileToMatrix

public boolean fileToMatrix(java.lang.String sPathFile)
Leer un archivo de texto y lo convierte en una matriz rectangular tipo "double".
Returns:
false. No se convirtio satisfactoriamente. true. Conversion exitosa.

show

public void show()
Muestra la matriz procesada.