From: <aki...@us...> - 2006-06-27 19:01:53
|
Revision: 213 Author: akirschbaum Date: 2006-06-27 12:01:38 -0700 (Tue, 27 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=213&view=rev Log Message: ----------- Unify identifier names, white space and comments. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CFArchTypeList.java trunk/crossfire/src/cfeditor/CFileReader.java trunk/daimonin/src/daieditor/CFileReader.java Modified: trunk/crossfire/src/cfeditor/CFArchTypeList.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchTypeList.java 2006-06-27 18:40:37 UTC (rev 212) +++ trunk/crossfire/src/cfeditor/CFArchTypeList.java 2006-06-27 19:01:38 UTC (rev 213) @@ -412,17 +412,17 @@ fileReader = new FileReader(spellfile.getAbsolutePath()); bufferedReader = new BufferedReader(fileReader); - CFileReader.readTill(bufferedReader, "spell spells", null); - CFileReader.readTill(bufferedReader, "{", null); + CFileReader.readUntil(bufferedReader, "spell spells", null); + CFileReader.readUntil(bufferedReader, "{", null); // reading spellnames one after the other, // this loop is terminated by an EOFException int i = 0; // index for insertion in the vector for (int counter = 0; true; counter++) { - CFileReader.readTill(bufferedReader, "{", "}"); - CFileReader.readTill(bufferedReader, "\"", null); - String name = CFileReader.readsTill(bufferedReader, "\""); - CFileReader.readTill(bufferedReader, "}", null); + CFileReader.readUntil(bufferedReader, "{", "}"); + CFileReader.readUntil(bufferedReader, "\"", null); + String name = CFileReader.readUntil(bufferedReader, "\""); + CFileReader.readUntil(bufferedReader, "}", null); name = name.trim(); // now insert this string lexographically into the vector Modified: trunk/crossfire/src/cfeditor/CFileReader.java =================================================================== --- trunk/crossfire/src/cfeditor/CFileReader.java 2006-06-27 18:40:37 UTC (rev 212) +++ trunk/crossfire/src/cfeditor/CFileReader.java 2006-06-27 19:01:38 UTC (rev 213) @@ -60,11 +60,14 @@ private BufferedReader read; + /** Maximum number of characters to read in readUntil. */ + private static final long READ_MAX = 10000L; + /** - * Constructor: Open an ascii-stream to the specified resource file. - * @param dname name of directory that the file is in - * (null means the file is located in the editor root dir) + * Open an ascii-stream to the specified resource file. + * @param dname name of directory that the file is in (<code>null</code> means the file is located in the editor root dir) * @param fname name of the resource file + * @throws FileNotFoundException in case all three tries to open the file failed */ public CFileReader(final String dname, final String fname) throws FileNotFoundException { filename = fname; @@ -130,8 +133,8 @@ * @throws EOFException the end of file was reached, or the 'abort' string * has been encountered */ - public static void readTill(final BufferedReader stream, final String tag, final String abort) throws IOException { - int c; // character value, read from the stream + public static void readUntil(final BufferedReader stream, final String tag, final String abort) throws IOException { + int c; // character value, read from the stream int t = 0; // tag index int a = 0; // abort index @@ -144,7 +147,6 @@ } else { t = 0; } - if (c == abort.charAt(a)) { a++; } else { @@ -176,8 +178,8 @@ /** * Reads characters from the BufferedReader stream till 'tag' is found. - * Similar to readTill(), except that the read String is returned. 'tag' is - * not included in the returned String. + * Similar to readUntil(), except that the read String is returned. 'tag' + * is not included in the returned String. * @param stream ascii input stream to read from * @param tag stop reading at the string 'tag' * @return the string between the starting pos. of 'stream' (inclusive) and @@ -185,16 +187,16 @@ * @throws IOException an I/O-error occurred while reading the file * @throws EOFException the end of file was reached */ - public static String readsTill(final BufferedReader stream, final String tag) throws IOException { + public static String readUntil(final BufferedReader stream, final String tag) throws IOException { String r = ""; // returned string - int c; // character value, read from the stream - int t = 0; // index + int c; // character value, read from the stream + int t = 0; // index - long count = 0; // counter (to realize when shooting past EOF) - final long maxCount = 10000; // bail out when counter exceeds this value + long count = 0; // counter (to realize when shooting past EOF) + final long maxCount = READ_MAX; // bail out when counter exceeds this value do { - c = stream.read(); // read one character + c = stream.read(); // read one character r += String.valueOf((char) c); // add character 'c' to the string if ((char) c == tag.charAt(t)) { t++; @@ -214,14 +216,14 @@ return r; } - // wrapper method for readTill, using BufferReader from 'this' - public void readTill(final String tag, final String abort) throws IOException { - readTill(read, tag, abort); + // wrapper method for readUntil, using BufferReader from 'this' + public void readUntil(final String tag, final String abort) throws IOException { + readUntil(read, tag, abort); } - // wrapper method for readsTill, using BufferReader from 'this' - public String readsTill(final String tag) throws IOException { - return readsTill(read, tag); + // wrapper method for readUntil, using BufferReader from 'this' + public String readUntil(final String tag) throws IOException { + return readUntil(read, tag); } /** close all open streams, print errormessages if closing failed */ Modified: trunk/daimonin/src/daieditor/CFileReader.java =================================================================== --- trunk/daimonin/src/daieditor/CFileReader.java 2006-06-27 18:40:37 UTC (rev 212) +++ trunk/daimonin/src/daieditor/CFileReader.java 2006-06-27 19:01:38 UTC (rev 213) @@ -60,7 +60,7 @@ * Open an ascii-stream to the specified resource file. * @param dname name of directory that the file is in (<code>null</code> means the file is located in the editor root dir) * @param fname name of the resource file - * @throws FileNotFoundException In case all three tries to open the file failed + * @throws FileNotFoundException in case all three tries to open the file failed */ public CFileReader(final String dname, final String fname) throws FileNotFoundException { super(createReader(dname, fname)); @@ -95,7 +95,7 @@ * an EOFException? That's semantically wrong, but current usage code * relies on this :( */ - public static void readUntil(final BufferedReader stream, final String tag, final String abort) throws IOException, EOFException { + public static void readUntil(final BufferedReader stream, final String tag, final String abort) throws IOException { int c; // character value, read from the stream int t = 0; // tag index int a = 0; // abort index @@ -149,7 +149,7 @@ * @throws IOException an I/O-error occurred while reading the file * @throws EOFException the end of file was reached */ - public static String readUntil(final BufferedReader stream, final String tag) throws IOException, EOFException { + public static String readUntil(final BufferedReader stream, final String tag) throws IOException { final StringBuilder sb = new StringBuilder(); int c; // character value, read from the stream int t = 0; // index This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |