/* * Angela Chen * Date: Feb 2005 * * File: TextFiles.java * * A Java application that reads tracklog files and writes * the easting and northing coordinates to a text file. * */ import java.util.*; import java.io.*; /** * class TextFiles */ public class TextFiles { private BufferedReader in; private PrintWriter out; private static String infile = "tracklogs/Jan_30_05.csv"; private static String outfile = "Jan_16_05.txt"; private static int numOfLines = 0; private static int easting[]; private static int northing[]; private static String tempEasting[]; private static String tempNorthing[]; private static int eastingDif[]; private static int northingDif[]; // other data in tracklog file private static String[] type, name, zoneNum, zoneChar, month, day, year, hour, minutes, seconds, altitude, depth; // each line in the file private static String dataStringArr[]; private static final int ARRAY_SIZE_OFFSET = 4; // size of indiv. arrays should be 4 less // than dataStringArr private static final int SET_ARRAY_OFFSET = 4; //4 line of dataStringArr /** * main() is the driver for this application. */ public static void main(String[] args) { TextFiles t= new TextFiles(); t.setNumOfLines(infile); // initialize arrays dataStringArr = new String[numOfLines]; // size has offset of 5, data starts on line 4 + 1 for array offset easting = new int[numOfLines-ARRAY_SIZE_OFFSET]; northing = new int[numOfLines-ARRAY_SIZE_OFFSET]; tempEasting = new String[numOfLines-ARRAY_SIZE_OFFSET]; tempNorthing = new String[numOfLines-ARRAY_SIZE_OFFSET]; eastingDif = new int[numOfLines-ARRAY_SIZE_OFFSET]; //new northingDif = new int[numOfLines-ARRAY_SIZE_OFFSET]; //new type = new String[numOfLines-ARRAY_SIZE_OFFSET]; name = new String[numOfLines-ARRAY_SIZE_OFFSET]; zoneNum = new String[numOfLines-ARRAY_SIZE_OFFSET]; zoneChar = new String[numOfLines-ARRAY_SIZE_OFFSET]; month = new String[numOfLines-ARRAY_SIZE_OFFSET]; day = new String[numOfLines-ARRAY_SIZE_OFFSET]; year = new String[numOfLines-ARRAY_SIZE_OFFSET]; hour = new String[numOfLines-ARRAY_SIZE_OFFSET]; minutes = new String[numOfLines-ARRAY_SIZE_OFFSET]; seconds = new String[numOfLines-ARRAY_SIZE_OFFSET]; altitude = new String[numOfLines-ARRAY_SIZE_OFFSET]; depth = new String[numOfLines-ARRAY_SIZE_OFFSET]; // Testing //System.out.println(dataStringArr.length); t.readData(infile); t.setArrays(); t.setEasting(); t.setNorthing(); for(int i = 0; i