diff --git a/src/java/com/samskivert/io/ByteArrayOutInputStream.java b/src/java/com/samskivert/io/ByteArrayOutInputStream.java
index c7b2e576..dec1f988 100644
--- a/src/java/com/samskivert/io/ByteArrayOutInputStream.java
+++ b/src/java/com/samskivert/io/ByteArrayOutInputStream.java
@@ -38,7 +38,7 @@ public class ByteArrayOutInputStream extends ByteArrayOutputStream
*/
public ByteArrayOutInputStream ()
{
- this(32);
+ this(32);
}
/**
diff --git a/src/java/com/samskivert/io/ExtensiblePrintStream.java b/src/java/com/samskivert/io/ExtensiblePrintStream.java
index 2142ea3d..ca60a741 100644
--- a/src/java/com/samskivert/io/ExtensiblePrintStream.java
+++ b/src/java/com/samskivert/io/ExtensiblePrintStream.java
@@ -81,56 +81,56 @@ public abstract class ExtensiblePrintStream extends PrintStream
public void print (char c)
{
super.print(c);
- handlePrinted(String.valueOf(c));
+ handlePrinted(String.valueOf(c));
}
@Override
public void print (int i)
{
super.print(i);
- handlePrinted(String.valueOf(i));
+ handlePrinted(String.valueOf(i));
}
@Override
public void print (long l)
{
super.print(l);
- handlePrinted(String.valueOf(l));
+ handlePrinted(String.valueOf(l));
}
@Override
public void print (float f)
{
super.print(f);
- handlePrinted(String.valueOf(f));
+ handlePrinted(String.valueOf(f));
}
@Override
public void print (double d)
{
super.print(d);
- handlePrinted(String.valueOf(d));
+ handlePrinted(String.valueOf(d));
}
@Override
public void print (char[] s)
{
super.print(s);
- handlePrinted(String.valueOf(s));
+ handlePrinted(String.valueOf(s));
}
@Override
public void print (String s)
{
super.print(s);
- handlePrinted((s == null) ? "null" : s);
+ handlePrinted((s == null) ? "null" : s);
}
@Override
public void print (Object obj)
{
super.print(obj);
- handlePrinted(String.valueOf(obj));
+ handlePrinted(String.valueOf(obj));
}
@Override
diff --git a/src/java/com/samskivert/jdbc/JDBCUtil.java b/src/java/com/samskivert/jdbc/JDBCUtil.java
index 5d49eebd..d05861f9 100644
--- a/src/java/com/samskivert/jdbc/JDBCUtil.java
+++ b/src/java/com/samskivert/jdbc/JDBCUtil.java
@@ -60,11 +60,11 @@ public class JDBCUtil
* nothing).
*/
public static void close (Statement stmt)
- throws SQLException
+ throws SQLException
{
- if (stmt != null) {
- stmt.close();
- }
+ if (stmt != null) {
+ stmt.close();
+ }
}
/**
@@ -72,11 +72,11 @@ public class JDBCUtil
* nothing).
*/
public static void close (Connection conn)
- throws SQLException
+ throws SQLException
{
- if (conn != null) {
- conn.close();
- }
+ if (conn != null) {
+ conn.close();
+ }
}
/**
diff --git a/src/java/com/samskivert/jdbc/Repository.java b/src/java/com/samskivert/jdbc/Repository.java
index b691fe2e..338cd75a 100644
--- a/src/java/com/samskivert/jdbc/Repository.java
+++ b/src/java/com/samskivert/jdbc/Repository.java
@@ -110,7 +110,7 @@ public class Repository
* indicative of a basic JDBC failure. The transaction
* will be rolled back in such cases, however.
*/
- public V invoke (Connection conn, DatabaseLiaison liaison)
+ public V invoke (Connection conn, DatabaseLiaison liaison)
throws SQLException, PersistenceException;
}
diff --git a/src/java/com/samskivert/jdbc/StaticConnectionProvider.java b/src/java/com/samskivert/jdbc/StaticConnectionProvider.java
index db16361b..0ae7ce14 100644
--- a/src/java/com/samskivert/jdbc/StaticConnectionProvider.java
+++ b/src/java/com/samskivert/jdbc/StaticConnectionProvider.java
@@ -256,14 +256,14 @@ public class StaticConnectionProvider implements ConnectionProvider
}
protected static String requireProp (Properties props, String name, String errmsg)
- throws PersistenceException
+ throws PersistenceException
{
- String value = props.getProperty(name);
- if (StringUtil.isBlank(value)) {
+ String value = props.getProperty(name);
+ if (StringUtil.isBlank(value)) {
errmsg = "Unable to get connection. " + errmsg; // augment the error message
- throw new PersistenceException(errmsg);
- }
- return value;
+ throw new PersistenceException(errmsg);
+ }
+ return value;
}
/** Contains information on a particular connection to which any number of database identifiers
diff --git a/src/java/com/samskivert/jdbc/jora/Cursor.java b/src/java/com/samskivert/jdbc/jora/Cursor.java
index 6fd607f3..d7bc86ea 100644
--- a/src/java/com/samskivert/jdbc/jora/Cursor.java
+++ b/src/java/com/samskivert/jdbc/jora/Cursor.java
@@ -45,7 +45,7 @@ public class Cursor
* more rows
*/
public V next ()
- throws SQLException
+ throws SQLException
{
// if we closed everything up after the last call to next(),
// table will be null here and we should bail immediately
@@ -78,7 +78,7 @@ public class Cursor
if (_stmt != null) {
_stmt.close();
}
- return null;
+ return null;
}
/**
@@ -119,11 +119,11 @@ public class Cursor
* drivers.
*/
public void update ()
- throws SQLException
+ throws SQLException
{
if (_currObject == null) {
- throw new IllegalStateException("No current object");
- }
+ throw new IllegalStateException("No current object");
+ }
_table.updateVariables(_result, _currObject);
}
@@ -142,11 +142,11 @@ public class Cursor
* drivers.
*/
public void delete ()
- throws SQLException
+ throws SQLException
{
if (_currObject == null) {
- throw new IllegalStateException("No current object");
- }
+ throw new IllegalStateException("No current object");
+ }
_result.deleteRow();
}
@@ -178,7 +178,7 @@ public class Cursor
* @return List with objects constructed from fetched records.
*/
public ArrayList toArrayList (int maxElements)
- throws SQLException
+ throws SQLException
{
ArrayList al = new ArrayList(Math.min(maxElements, 100));
V o;
@@ -197,7 +197,7 @@ public class Cursor
* @return Array with objects constructed from fetched records.
*/
public ArrayList toArrayList ()
- throws SQLException
+ throws SQLException
{
return toArrayList(Integer.MAX_VALUE);
}
@@ -213,12 +213,12 @@ public class Cursor
FieldMask mask, boolean like)
{
_table = table;
- _conn = conn;
+ _conn = conn;
_like = like;
- _qbeObject = obj;
+ _qbeObject = obj;
_qbeMask = mask;
- _query = table.buildQueryList(obj, mask, like);
- _stmt = null;
+ _query = table.buildQueryList(obj, mask, like);
+ _stmt = null;
}
protected Table _table;
diff --git a/src/java/com/samskivert/jdbc/jora/FieldDescriptor.java b/src/java/com/samskivert/jdbc/jora/FieldDescriptor.java
index d446a41f..68a53cf7 100644
--- a/src/java/com/samskivert/jdbc/jora/FieldDescriptor.java
+++ b/src/java/com/samskivert/jdbc/jora/FieldDescriptor.java
@@ -30,7 +30,7 @@ class FieldDescriptor
{
this.name = name;
this.field = field;
- this.scale = -1;
+ this.scale = -1;
}
protected final boolean isAtomic ()
@@ -53,336 +53,320 @@ class FieldDescriptor
throws SQLException
{
try {
- switch (outType) {
+ switch (outType) {
case t_byte:
- pstmt.setByte(column, field.getByte(obj));
- break;
+ pstmt.setByte(column, field.getByte(obj));
+ break;
case t_short:
- pstmt.setShort(column, field.getShort(obj));
- break;
+ pstmt.setShort(column, field.getShort(obj));
+ break;
case t_int:
- pstmt.setInt(column, field.getInt(obj));
- break;
+ pstmt.setInt(column, field.getInt(obj));
+ break;
case t_long:
- pstmt.setLong(column, field.getLong(obj));
- break;
+ pstmt.setLong(column, field.getLong(obj));
+ break;
case t_float:
- pstmt.setFloat(column, field.getFloat(obj));
- break;
+ pstmt.setFloat(column, field.getFloat(obj));
+ break;
case t_double:
- pstmt.setDouble(column, field.getDouble(obj));
- break;
+ pstmt.setDouble(column, field.getDouble(obj));
+ break;
case t_boolean:
- pstmt.setBoolean(column, field.getBoolean(obj));
- break;
+ pstmt.setBoolean(column, field.getBoolean(obj));
+ break;
case tByte:
- pstmt.setByte(column, ((Byte)field.get(obj)).byteValue());
- break;
+ pstmt.setByte(column, ((Byte)field.get(obj)).byteValue());
+ break;
case tShort:
- pstmt.setShort(column, ((Short)field.get(obj)).shortValue());
- break;
+ pstmt.setShort(column, ((Short)field.get(obj)).shortValue());
+ break;
case tInteger:
- pstmt.setInt(column, ((Integer)field.get(obj)).intValue());
- break;
+ pstmt.setInt(column, ((Integer)field.get(obj)).intValue());
+ break;
case tLong:
- pstmt.setLong(column, ((Long)field.get(obj)).longValue());
- break;
+ pstmt.setLong(column, ((Long)field.get(obj)).longValue());
+ break;
case tFloat:
- pstmt.setFloat(column, ((Float)field.get(obj)).floatValue());
- break;
+ pstmt.setFloat(column, ((Float)field.get(obj)).floatValue());
+ break;
case tDouble:
- pstmt.setDouble(column,((Double)field.get(obj)).doubleValue());
- break;
+ pstmt.setDouble(column,((Double)field.get(obj)).doubleValue());
+ break;
case tBoolean:
- pstmt.setBoolean(column,
- ((Boolean)field.get(obj)).booleanValue());
- break;
+ pstmt.setBoolean(column, ((Boolean)field.get(obj)).booleanValue());
+ break;
case tDecimal:
- pstmt.setBigDecimal(column, (BigDecimal)field.get(obj));
- break;
+ pstmt.setBigDecimal(column, (BigDecimal)field.get(obj));
+ break;
case tString:
- pstmt.setString(column, (String)field.get(obj));
- break;
+ pstmt.setString(column, (String)field.get(obj));
+ break;
case tBytes:
- pstmt.setBytes(column, (byte[])field.get(obj));
- break;
+ pstmt.setBytes(column, (byte[])field.get(obj));
+ break;
case tDate:
- pstmt.setDate(column, (java.sql.Date)field.get(obj));
- break;
+ pstmt.setDate(column, (java.sql.Date)field.get(obj));
+ break;
case tTime:
- pstmt.setTime(column, (java.sql.Time)field.get(obj));
- break;
+ pstmt.setTime(column, (java.sql.Time)field.get(obj));
+ break;
case tTimestamp:
- pstmt.setTimestamp(column, (java.sql.Timestamp)field.get(obj));
- break;
+ pstmt.setTimestamp(column, (java.sql.Timestamp)field.get(obj));
+ break;
case tStream:
- java.io.InputStream in = (java.io.InputStream)field.get(obj);
- pstmt.setBinaryStream(column, in, in.available());
- break;
+ java.io.InputStream in = (java.io.InputStream)field.get(obj);
+ pstmt.setBinaryStream(column, in, in.available());
+ break;
case tBlob:
- pstmt.setBlob(column, (Blob)field.get(obj));
- break;
+ pstmt.setBlob(column, (Blob)field.get(obj));
+ break;
case tClob:
- pstmt.setClob(column, (Clob)field.get(obj));
- break;
+ pstmt.setClob(column, (Clob)field.get(obj));
+ break;
case tAsString:
- pstmt.setString(column, field.get(obj).toString());
- break;
+ pstmt.setString(column, field.get(obj).toString());
+ break;
case tClosure:
- // There is no reason to use piped streams because
- // we need to pass total number of bytes to JDBC driver
- java.io.ByteArrayOutputStream out =
- new java.io.ByteArrayOutputStream();
- java.io.ObjectOutputStream clu =
- new java.io.ObjectOutputStream(out);
- clu.writeObject(field.get(obj));
- clu.close();
- pstmt.setBytes(column, out.toByteArray());
- break;
+ // There is no reason to use piped streams because
+ // we need to pass total number of bytes to JDBC driver
+ java.io.ByteArrayOutputStream out = new java.io.ByteArrayOutputStream();
+ java.io.ObjectOutputStream clu = new java.io.ObjectOutputStream(out);
+ clu.writeObject(field.get(obj));
+ clu.close();
+ pstmt.setBytes(column, out.toByteArray());
+ break;
default:
- return false;
- }
- } catch(SQLException ex) {
- if (outType != tClosure && outType != tAsString) {
- outType = tAsString;
- return bindVariable(pstmt, obj, column);
- } else {
- throw ex;
- }
- } catch(IllegalAccessException ex) {
- ex.printStackTrace();
- throw new IllegalAccessError();
- } catch(java.io.IOException ex) {
- throw new DataTransferError(ex);
- }
- return true;
+ return false;
+ }
+ } catch(SQLException ex) {
+ if (outType != tClosure && outType != tAsString) {
+ outType = tAsString;
+ return bindVariable(pstmt, obj, column);
+ } else {
+ throw ex;
+ }
+ } catch(IllegalAccessException ex) {
+ ex.printStackTrace();
+ throw new IllegalAccessError();
+ } catch(java.io.IOException ex) {
+ throw new DataTransferError(ex);
+ }
+ return true;
}
- protected final boolean updateVariable (
- ResultSet result, Object obj, int column)
+ protected final boolean updateVariable (ResultSet result, Object obj, int column)
throws SQLException
{
try {
- switch (outType) {
+ switch (outType) {
case t_byte:
- result.updateByte(column, field.getByte(obj));
- break;
+ result.updateByte(column, field.getByte(obj));
+ break;
case t_short:
- result.updateShort(column, field.getShort(obj));
- break;
+ result.updateShort(column, field.getShort(obj));
+ break;
case t_int:
- result.updateInt(column, field.getInt(obj));
- break;
+ result.updateInt(column, field.getInt(obj));
+ break;
case t_long:
- result.updateLong(column, field.getLong(obj));
- break;
+ result.updateLong(column, field.getLong(obj));
+ break;
case t_float:
- result.updateFloat(column, field.getFloat(obj));
- break;
+ result.updateFloat(column, field.getFloat(obj));
+ break;
case t_double:
- result.updateDouble(column, field.getDouble(obj));
- break;
+ result.updateDouble(column, field.getDouble(obj));
+ break;
case t_boolean:
- result.updateBoolean(column, field.getBoolean(obj));
- break;
+ result.updateBoolean(column, field.getBoolean(obj));
+ break;
case tByte:
- result.updateByte(column, ((Byte)field.get(obj)).byteValue());
- break;
+ result.updateByte(column, ((Byte)field.get(obj)).byteValue());
+ break;
case tShort:
- result.updateShort(column,
- ((Short)field.get(obj)).shortValue());
- break;
+ result.updateShort(column, ((Short)field.get(obj)).shortValue());
+ break;
case tInteger:
- result.updateInt(column, ((Integer)field.get(obj)).intValue());
- break;
+ result.updateInt(column, ((Integer)field.get(obj)).intValue());
+ break;
case tLong:
- result.updateLong(column, ((Long)field.get(obj)).longValue());
- break;
+ result.updateLong(column, ((Long)field.get(obj)).longValue());
+ break;
case tFloat:
- result.updateFloat(column,
- ((Float)field.get(obj)).floatValue());
- break;
+ result.updateFloat(column, ((Float)field.get(obj)).floatValue());
+ break;
case tDouble:
- result.updateDouble(column,
- ((Double)field.get(obj)).doubleValue());
- break;
+ result.updateDouble(column, ((Double)field.get(obj)).doubleValue());
+ break;
case tBoolean:
- result.updateBoolean(column,
- ((Boolean)field.get(obj)).booleanValue());
- break;
+ result.updateBoolean(column, ((Boolean)field.get(obj)).booleanValue());
+ break;
case tDecimal:
- result.updateBigDecimal(column, (BigDecimal)field.get(obj));
- break;
+ result.updateBigDecimal(column, (BigDecimal)field.get(obj));
+ break;
case tString:
- result.updateString(column, (String)field.get(obj));
- break;
+ result.updateString(column, (String)field.get(obj));
+ break;
case tBytes:
- result.updateBytes(column, (byte[])field.get(obj));
- break;
+ result.updateBytes(column, (byte[])field.get(obj));
+ break;
case tDate:
- result.updateDate(column, (java.sql.Date)field.get(obj));
- break;
+ result.updateDate(column, (java.sql.Date)field.get(obj));
+ break;
case tTime:
- result.updateTime(column, (java.sql.Time)field.get(obj));
- break;
+ result.updateTime(column, (java.sql.Time)field.get(obj));
+ break;
case tTimestamp:
- result.updateTimestamp(column,
- (java.sql.Timestamp)field.get(obj));
- break;
+ result.updateTimestamp(column, (java.sql.Timestamp)field.get(obj));
+ break;
case tStream:
- java.io.InputStream in = (java.io.InputStream)field.get(obj);
- result.updateBinaryStream(column, in, in.available());
- break;
+ java.io.InputStream in = (java.io.InputStream)field.get(obj);
+ result.updateBinaryStream(column, in, in.available());
+ break;
case tBlob:
- Blob blob = (Blob)field.get(obj);
- result.updateBinaryStream(column,
- blob.getBinaryStream(),
- (int)blob.length());
- break;
+ Blob blob = (Blob)field.get(obj);
+ result.updateBinaryStream(column, blob.getBinaryStream(), (int)blob.length());
+ break;
case tClob:
- Clob clob = (Clob)field.get(obj);
- result.updateCharacterStream(column,
- clob.getCharacterStream(),
- (int)clob.length());
- break;
+ Clob clob = (Clob)field.get(obj);
+ result.updateCharacterStream(column, clob.getCharacterStream(), (int)clob.length());
+ break;
case tAsString:
- result.updateString(column, field.get(obj).toString());
- break;
+ result.updateString(column, field.get(obj).toString());
+ break;
case tClosure:
- // There is no reason to use piped streams because
- // we need to pass total number of bytes to JDBC driver
- java.io.ByteArrayOutputStream out =
- new java.io.ByteArrayOutputStream();
- java.io.ObjectOutputStream clu =
- new java.io.ObjectOutputStream(out);
- clu.writeObject(field.get(obj));
- clu.close();
- result.updateBytes(column, out.toByteArray());
- break;
+ // There is no reason to use piped streams because
+ // we need to pass total number of bytes to JDBC driver
+ java.io.ByteArrayOutputStream out = new java.io.ByteArrayOutputStream();
+ java.io.ObjectOutputStream clu = new java.io.ObjectOutputStream(out);
+ clu.writeObject(field.get(obj));
+ clu.close();
+ result.updateBytes(column, out.toByteArray());
+ break;
default:
- return false;
- }
- } catch(SQLException ex) {
- if (outType != tClosure && outType != tAsString) {
- outType = tAsString;
- return updateVariable(result, obj, column);
- } else {
- throw ex;
- }
- } catch(IllegalAccessException ex) {
- ex.printStackTrace();
- throw new IllegalAccessError();
- } catch(java.io.IOException ex) {
- throw new DataTransferError(ex);
- }
- return true;
+ return false;
+ }
+ } catch(SQLException ex) {
+ if (outType != tClosure && outType != tAsString) {
+ outType = tAsString;
+ return updateVariable(result, obj, column);
+ } else {
+ throw ex;
+ }
+ } catch(IllegalAccessException ex) {
+ ex.printStackTrace();
+ throw new IllegalAccessError();
+ } catch(java.io.IOException ex) {
+ throw new DataTransferError(ex);
+ }
+ return true;
}
protected final boolean loadVariable (
ResultSet result, Object obj, int column)
throws SQLException, IllegalAccessException
{
- switch (inType) {
+ switch (inType) {
case t_byte:
- field.setByte(obj, result.getByte(column));
- break;
+ field.setByte(obj, result.getByte(column));
+ break;
case t_short:
- field.setShort(obj, result.getShort(column));
- break;
+ field.setShort(obj, result.getShort(column));
+ break;
case t_int:
- field.setInt(obj, result.getInt(column));
- break;
+ field.setInt(obj, result.getInt(column));
+ break;
case t_long:
- field.setLong(obj, result.getLong(column));
- break;
+ field.setLong(obj, result.getLong(column));
+ break;
case t_float:
- field.setFloat(obj, result.getFloat(column));
- break;
+ field.setFloat(obj, result.getFloat(column));
+ break;
case t_double:
- field.setDouble(obj, result.getDouble(column));
- break;
+ field.setDouble(obj, result.getDouble(column));
+ break;
case t_boolean:
- field.setBoolean(obj, result.getBoolean(column));
- break;
+ field.setBoolean(obj, result.getBoolean(column));
+ break;
case tByte:
- byte b = result.getByte(column);
- field.set(obj, result.wasNull() ? null : Byte.valueOf(b));
- break;
+ byte b = result.getByte(column);
+ field.set(obj, result.wasNull() ? null : Byte.valueOf(b));
+ break;
case tShort:
- short s = result.getShort(column);
- field.set(obj, result.wasNull() ? null : Short.valueOf(s));
- break;
+ short s = result.getShort(column);
+ field.set(obj, result.wasNull() ? null : Short.valueOf(s));
+ break;
case tInteger:
- int i = result.getInt(column);
- field.set(obj, result.wasNull() ? null : Integer.valueOf(i));
- break;
+ int i = result.getInt(column);
+ field.set(obj, result.wasNull() ? null : Integer.valueOf(i));
+ break;
case tLong:
- long l = result.getLong(column);
- field.set(obj, result.wasNull() ? null : Long.valueOf(l));
- break;
+ long l = result.getLong(column);
+ field.set(obj, result.wasNull() ? null : Long.valueOf(l));
+ break;
case tFloat:
- float f = result.getFloat(column);
- field.set(obj, result.wasNull() ? null : Float.valueOf(f));
- field.setFloat(obj, result.getFloat(column));
- break;
+ float f = result.getFloat(column);
+ field.set(obj, result.wasNull() ? null : Float.valueOf(f));
+ field.setFloat(obj, result.getFloat(column));
+ break;
case tDouble:
- double d = result.getDouble(column);
- field.set(obj, result.wasNull() ? null : Double.valueOf(d));
- break;
+ double d = result.getDouble(column);
+ field.set(obj, result.wasNull() ? null : Double.valueOf(d));
+ break;
case tBoolean:
- boolean bl = result.getBoolean(column);
- field.set(obj, result.wasNull() ? null : Boolean.valueOf(bl));
- break;
+ boolean bl = result.getBoolean(column);
+ field.set(obj, result.wasNull() ? null : Boolean.valueOf(bl));
+ break;
case tDecimal:
field.set(obj, result.getBigDecimal(column));
- break;
+ break;
case tString:
- field.set(obj, result.getString(column));
- break;
+ field.set(obj, result.getString(column));
+ break;
case tBytes:
- field.set(obj, result.getBytes(column));
- break;
+ field.set(obj, result.getBytes(column));
+ break;
case tDate:
- field.set(obj, result.getDate(column));
- break;
+ field.set(obj, result.getDate(column));
+ break;
case tTime:
- field.set(obj, result.getTime(column));
- break;
+ field.set(obj, result.getTime(column));
+ break;
case tTimestamp:
- field.set(obj, result.getTimestamp(column));
- break;
+ field.set(obj, result.getTimestamp(column));
+ break;
case tStream:
- field.set(obj, result.getBinaryStream(column));
- break;
+ field.set(obj, result.getBinaryStream(column));
+ break;
case tBlob:
- field.set(obj, result.getBlob(column));
- break;
+ field.set(obj, result.getBlob(column));
+ break;
case tClob:
- field.set(obj, result.getClob(column));
- break;
+ field.set(obj, result.getClob(column));
+ break;
case tClosure:
- try {
+ try {
java.io.InputStream input = result.getBinaryStream(column);
- java.io.ObjectInputStream in =
- new java.io.ObjectInputStream(input);
- field.set(obj, in.readObject());
- in.close();
- } catch(ClassNotFoundException ex) {
- throw new DataTransferError(ex);
- } catch(java.io.IOException ex) {
- throw new DataTransferError(ex);
- }
- break;
+ java.io.ObjectInputStream in = new java.io.ObjectInputStream(input);
+ field.set(obj, in.readObject());
+ in.close();
+ } catch(ClassNotFoundException ex) {
+ throw new DataTransferError(ex);
+ } catch(java.io.IOException ex) {
+ throw new DataTransferError(ex);
+ }
+ break;
default:
- return false;
- }
- return true;
+ return false;
+ }
+ return true;
}
protected int inType; // type tag for field input (see constants below)
diff --git a/src/java/com/samskivert/net/cddb/CDDBException.java b/src/java/com/samskivert/net/cddb/CDDBException.java
index 92ff64db..78a1f233 100644
--- a/src/java/com/samskivert/net/cddb/CDDBException.java
+++ b/src/java/com/samskivert/net/cddb/CDDBException.java
@@ -32,13 +32,13 @@ public class CDDBException extends Exception
{
public CDDBException (int code, String message)
{
- super(message);
- _code = code;
+ super(message);
+ _code = code;
}
public int getCode ()
{
- return _code;
+ return _code;
}
protected int _code;
diff --git a/src/java/com/samskivert/net/cddb/CDDBProtocol.java b/src/java/com/samskivert/net/cddb/CDDBProtocol.java
index 263730b1..671adda4 100644
--- a/src/java/com/samskivert/net/cddb/CDDBProtocol.java
+++ b/src/java/com/samskivert/net/cddb/CDDBProtocol.java
@@ -45,7 +45,7 @@ public class CDDBProtocol
*/
public static int codeFamily (int code)
{
- return (code / 100) * 100;
+ return (code / 100) * 100;
}
/**
@@ -54,7 +54,7 @@ public class CDDBProtocol
*/
public static int codeGenus (int code)
{
- return ((code % 100) / 10) * 10;
+ return ((code % 100) / 10) * 10;
}
/**
@@ -63,6 +63,6 @@ public class CDDBProtocol
*/
public static int codeSpecies (int code)
{
- return code % 10;
+ return code % 10;
}
}
diff --git a/src/java/com/samskivert/net/cddb/CDDBTest.java b/src/java/com/samskivert/net/cddb/CDDBTest.java
index 436955ea..e8f43dc8 100644
--- a/src/java/com/samskivert/net/cddb/CDDBTest.java
+++ b/src/java/com/samskivert/net/cddb/CDDBTest.java
@@ -27,70 +27,68 @@ package com.samskivert.net.cddb;
public class CDDBTest
{
public static void test (String hostname, String cdid)
- throws Exception
+ throws Exception
{
- CDDB cddb = new CDDB();
+ CDDB cddb = new CDDB();
- try {
- /* String rsp = */ cddb.connect(hostname);
+ try {
+ /* String rsp = */ cddb.connect(hostname);
- // set the timeout to 30 seconds
- cddb.setTimeout(30*1000);
+ // set the timeout to 30 seconds
+ cddb.setTimeout(30*1000);
- // try a test query
- int[] offsets = { 150, 18130, 48615 };
- int length = 893;
- CDDB.Entry[] entries = cddb.query(cdid, offsets, length);
+ // try a test query
+ int[] offsets = { 150, 18130, 48615 };
+ int length = 893;
+ CDDB.Entry[] entries = cddb.query(cdid, offsets, length);
- if (entries == null || entries.length == 0) {
- System.out.println("No match for " + cdid + ".");
+ if (entries == null || entries.length == 0) {
+ System.out.println("No match for " + cdid + ".");
- } else {
- for (int i = 0; i < entries.length; i++) {
- System.out.println("Match " + entries[i].category + "/" +
- entries[i].cdid + "/" +
- entries[i].title);
- }
+ } else {
+ for (int i = 0; i < entries.length; i++) {
+ System.out.println("Match " + entries[i].category + "/" +
+ entries[i].cdid + "/" +
+ entries[i].title);
+ }
- CDDB.Detail detail = cddb.read(entries[0].category,
- entries[0].cdid);
- System.out.println("Title: " + detail.title);
- for (int i = 0; i < detail.trackNames.length; i++) {
- System.out.println(pad(i) + ": " + detail.trackNames[i]);
- }
- System.out.println("Extended data: " + detail.extendedData);
- for (int i = 0; i < detail.extendedTrackData.length; i++) {
- System.out.println(pad(i) + ": " +
- detail.extendedTrackData[i]);
- }
- }
+ CDDB.Detail detail = cddb.read(entries[0].category,
+ entries[0].cdid);
+ System.out.println("Title: " + detail.title);
+ for (int i = 0; i < detail.trackNames.length; i++) {
+ System.out.println(pad(i) + ": " + detail.trackNames[i]);
+ }
+ System.out.println("Extended data: " + detail.extendedData);
+ for (int i = 0; i < detail.extendedTrackData.length; i++) {
+ System.out.println(pad(i) + ": " + detail.extendedTrackData[i]);
+ }
+ }
- } finally {
- cddb.close();
- }
+ } finally {
+ cddb.close();
+ }
}
protected static String pad (int value)
{
- return ((value > 9) ? "" : " ") + value;
+ return ((value > 9) ? "" : " ") + value;
}
public static void main (String[] args)
{
- if (args.length < 1) {
- System.err.println("Usage: CDDBTest cddbhost");
- System.exit(-1);
- }
+ if (args.length < 1) {
+ System.err.println("Usage: CDDBTest cddbhost");
+ System.exit(-1);
+ }
- try {
- test(args[0], "1b037b03");
+ try {
+ test(args[0], "1b037b03");
- } catch (CDDBException ce) {
- System.err.println("Protocol exception: " + ce.getCode() +
- ": " + ce.getMessage());
+ } catch (CDDBException ce) {
+ System.err.println("Protocol exception: " + ce.getCode() + ": " + ce.getMessage());
- } catch (Throwable t) {
- t.printStackTrace(System.err);
- }
+ } catch (Throwable t) {
+ t.printStackTrace(System.err);
+ }
}
}
diff --git a/src/java/com/samskivert/servlet/RedirectException.java b/src/java/com/samskivert/servlet/RedirectException.java
index 056c4c82..851fa87a 100644
--- a/src/java/com/samskivert/servlet/RedirectException.java
+++ b/src/java/com/samskivert/servlet/RedirectException.java
@@ -32,11 +32,11 @@ public class RedirectException extends Exception
{
public RedirectException (String url)
{
- super(url);
+ super(url);
}
public String getRedirectURL ()
{
- return getMessage();
+ return getMessage();
}
}
diff --git a/src/java/com/samskivert/servlet/util/DataValidationException.java b/src/java/com/samskivert/servlet/util/DataValidationException.java
index d41d71e9..a3203a4e 100644
--- a/src/java/com/samskivert/servlet/util/DataValidationException.java
+++ b/src/java/com/samskivert/servlet/util/DataValidationException.java
@@ -30,6 +30,6 @@ public class DataValidationException extends FriendlyException
{
public DataValidationException (String message)
{
- super(message);
+ super(message);
}
}
diff --git a/src/java/com/samskivert/servlet/util/ExceptionMap.java b/src/java/com/samskivert/servlet/util/ExceptionMap.java
index 0cecc838..b771b1c5 100644
--- a/src/java/com/samskivert/servlet/util/ExceptionMap.java
+++ b/src/java/com/samskivert/servlet/util/ExceptionMap.java
@@ -77,57 +77,57 @@ public class ExceptionMap
*/
public static synchronized void init ()
{
- // only initialize ourselves once
- if (_keys != null) {
- return;
- } else {
- _keys = new ArrayList>();
- _values = new ArrayList();
- }
+ // only initialize ourselves once
+ if (_keys != null) {
+ return;
+ } else {
+ _keys = new ArrayList>();
+ _values = new ArrayList();
+ }
- // first try loading the properties file without a leading slash
- ClassLoader cld = ExceptionMap.class.getClassLoader();
- InputStream config = ConfigUtil.getStream(PROPS_NAME, cld);
- if (config == null) {
- log.warning("Unable to load " + PROPS_NAME + " from CLASSPATH.");
+ // first try loading the properties file without a leading slash
+ ClassLoader cld = ExceptionMap.class.getClassLoader();
+ InputStream config = ConfigUtil.getStream(PROPS_NAME, cld);
+ if (config == null) {
+ log.warning("Unable to load " + PROPS_NAME + " from CLASSPATH.");
- } else {
- // otherwise process ye old config file.
- try {
- // we'll do some serious jiggery pokery to leverage the parsing
- // implementation provided by java.util.Properties. god bless
- // method overloading
+ } else {
+ // otherwise process ye old config file.
+ try {
+ // we'll do some serious jiggery pokery to leverage the parsing
+ // implementation provided by java.util.Properties. god bless
+ // method overloading
final ArrayList classes = new ArrayList();
Properties loader = new Properties() {
- @Override public Object put (Object key, Object value) {
- classes.add((String)key);
- _values.add((String)value);
- return key;
- }
- };
- loader.load(config);
+ @Override public Object put (Object key, Object value) {
+ classes.add((String)key);
+ _values.add((String)value);
+ return key;
+ }
+ };
+ loader.load(config);
- // now cruise through and resolve the exceptions named as
- // keys and throw out any that don't appear to exist
- for (int i = 0; i < classes.size(); i++) {
- String exclass = classes.get(i);
- try {
- Class> cl = Class.forName(exclass);
- // replace the string with the class object
- _keys.add(cl);
+ // now cruise through and resolve the exceptions named as
+ // keys and throw out any that don't appear to exist
+ for (int i = 0; i < classes.size(); i++) {
+ String exclass = classes.get(i);
+ try {
+ Class> cl = Class.forName(exclass);
+ // replace the string with the class object
+ _keys.add(cl);
- } catch (Throwable t) {
- log.warning("Unable to resolve exception class.", "class", exclass,
+ } catch (Throwable t) {
+ log.warning("Unable to resolve exception class.", "class", exclass,
"error", t);
- _values.remove(i);
- i--; // back on up a notch
- }
- }
+ _values.remove(i);
+ i--; // back on up a notch
+ }
+ }
- } catch (IOException ioe) {
- log.warning("Error reading exception mapping file: " + ioe);
- }
- }
+ } catch (IOException ioe) {
+ log.warning("Error reading exception mapping file: " + ioe);
+ }
+ }
}
/**
@@ -142,15 +142,15 @@ public class ExceptionMap
*/
public static String getMessage (Throwable ex)
{
- String msg = DEFAULT_ERROR_MSG;
- for (int i = 0; i < _keys.size(); i++) {
- Class> cl = _keys.get(i);
- if (cl.isInstance(ex)) {
- msg = _values.get(i);
- break;
- }
- }
- return StringUtil.replace(msg, MESSAGE_MARKER, ex.getMessage());
+ String msg = DEFAULT_ERROR_MSG;
+ for (int i = 0; i < _keys.size(); i++) {
+ Class> cl = _keys.get(i);
+ if (cl.isInstance(ex)) {
+ msg = _values.get(i);
+ break;
+ }
+ }
+ return StringUtil.replace(msg, MESSAGE_MARKER, ex.getMessage());
}
protected static List> _keys;
diff --git a/src/java/com/samskivert/servlet/util/FriendlyException.java b/src/java/com/samskivert/servlet/util/FriendlyException.java
index 1d007b0c..8c0a5550 100644
--- a/src/java/com/samskivert/servlet/util/FriendlyException.java
+++ b/src/java/com/samskivert/servlet/util/FriendlyException.java
@@ -29,6 +29,6 @@ public class FriendlyException extends Exception
{
public FriendlyException (String message)
{
- super(message);
+ super(message);
}
}
diff --git a/src/java/com/samskivert/servlet/util/ParameterUtil.java b/src/java/com/samskivert/servlet/util/ParameterUtil.java
index a6cf4a84..2c3d052e 100644
--- a/src/java/com/samskivert/servlet/util/ParameterUtil.java
+++ b/src/java/com/samskivert/servlet/util/ParameterUtil.java
@@ -73,7 +73,7 @@ public class ParameterUtil
*/
public static String getParameter (HttpServletRequest req, String name, boolean returnNull)
{
- String value = req.getParameter(name);
+ String value = req.getParameter(name);
if (value == null) {
return returnNull ? null : "";
} else {
@@ -88,9 +88,9 @@ public class ParameterUtil
*/
public static float requireFloatParameter (
HttpServletRequest req, String name, String invalidDataMessage)
- throws DataValidationException
+ throws DataValidationException
{
- return parseFloatParameter(getParameter(req, name, false), invalidDataMessage);
+ return parseFloatParameter(getParameter(req, name, false), invalidDataMessage);
}
/**
@@ -100,9 +100,9 @@ public class ParameterUtil
*/
public static int requireIntParameter (
HttpServletRequest req, String name, String invalidDataMessage)
- throws DataValidationException
+ throws DataValidationException
{
- return parseIntParameter(getParameter(req, name, false), invalidDataMessage);
+ return parseIntParameter(getParameter(req, name, false), invalidDataMessage);
}
/**
@@ -112,11 +112,11 @@ public class ParameterUtil
*/
public static int requireIntParameter (HttpServletRequest req, String name,
String invalidDataMessage, ParameterValidator validator)
- throws DataValidationException
+ throws DataValidationException
{
String value = getParameter(req, name, false);
validator.validateParameter(name, value);
- return parseIntParameter(value, invalidDataMessage);
+ return parseIntParameter(value, invalidDataMessage);
}
/**
@@ -126,7 +126,7 @@ public class ParameterUtil
*/
public static int requireIntParameter (HttpServletRequest req, String name, int low, int high,
String invalidDataMessage)
- throws DataValidationException
+ throws DataValidationException
{
return requireIntParameter(
req, name, invalidDataMessage, new IntRangeValidator(low, high, invalidDataMessage));
@@ -176,7 +176,7 @@ public class ParameterUtil
*/
public static String getParameter (HttpServletRequest req, String name, String defval)
{
- String value = req.getParameter(name);
+ String value = req.getParameter(name);
return StringUtil.isBlank(value) ? defval : value.trim();
}
@@ -187,9 +187,9 @@ public class ParameterUtil
*/
public static int getIntParameter (
HttpServletRequest req, String name, int defval, String invalidDataMessage)
- throws DataValidationException
+ throws DataValidationException
{
- String value = getParameter(req, name, false);
+ String value = getParameter(req, name, false);
if (StringUtil.isBlank(value)) {
return defval;
}
@@ -203,9 +203,9 @@ public class ParameterUtil
*/
public static long getLongParameter (
HttpServletRequest req, String name, long defval, String invalidDataMessage)
- throws DataValidationException
+ throws DataValidationException
{
- String value = getParameter(req, name, false);
+ String value = getParameter(req, name, false);
if (StringUtil.isBlank(value)) {
return defval;
}
@@ -218,13 +218,13 @@ public class ParameterUtil
*/
public static String requireParameter (
HttpServletRequest req, String name, String missingDataMessage)
- throws DataValidationException
+ throws DataValidationException
{
- String value = getParameter(req, name, true);
- if (StringUtil.isBlank(value)) {
- throw new DataValidationException(missingDataMessage);
- }
- return value;
+ String value = getParameter(req, name, true);
+ if (StringUtil.isBlank(value)) {
+ throw new DataValidationException(missingDataMessage);
+ }
+ return value;
}
/**
@@ -238,7 +238,7 @@ public class ParameterUtil
*/
public static String requireParameter (
HttpServletRequest req, String name, String missingDataMessage, int maxLength)
- throws DataValidationException
+ throws DataValidationException
{
return StringUtil.truncate(
requireParameter(req, name, missingDataMessage), maxLength);
@@ -251,7 +251,7 @@ public class ParameterUtil
*/
public static Date requireDateParameter (
HttpServletRequest req, String name, String invalidDataMessage)
- throws DataValidationException
+ throws DataValidationException
{
return parseDateParameter(getParameter(req, name, false), invalidDataMessage);
}
@@ -261,7 +261,7 @@ public class ParameterUtil
*/
public static java.sql.Date requireSQLDateParameter (
HttpServletRequest req, String name, String invalidDataMessage)
- throws DataValidationException
+ throws DataValidationException
{
return new java.sql.Date(requireDateParameter(req, name, invalidDataMessage).getTime());
}
@@ -274,9 +274,9 @@ public class ParameterUtil
*/
public static Date getDateParameter (
HttpServletRequest req, String name, String invalidDataMessage)
- throws DataValidationException
+ throws DataValidationException
{
- String value = getParameter(req, name, false);
+ String value = getParameter(req, name, false);
if (StringUtil.isBlank(value) ||
DATE_TEMPLATE.equalsIgnoreCase(value)) {
return null;
@@ -289,7 +289,7 @@ public class ParameterUtil
*/
public static java.sql.Date getSQLDateParameter (
HttpServletRequest req, String name, String invalidDataMessage)
- throws DataValidationException
+ throws DataValidationException
{
Date when = getDateParameter(req, name, invalidDataMessage);
return (when == null) ? null : new java.sql.Date(when.getTime());
@@ -329,7 +329,7 @@ public class ParameterUtil
*/
public static boolean parameterEquals (HttpServletRequest req, String name, String value)
{
- return value.equals(getParameter(req, name, false));
+ return value.equals(getParameter(req, name, false));
}
/**
@@ -339,10 +339,10 @@ public class ParameterUtil
throws DataValidationException
{
try {
- return Integer.parseInt(value);
- } catch (NumberFormatException nfe) {
- throw new DataValidationException(invalidDataMessage);
- }
+ return Integer.parseInt(value);
+ } catch (NumberFormatException nfe) {
+ throw new DataValidationException(invalidDataMessage);
+ }
}
/**
@@ -352,10 +352,10 @@ public class ParameterUtil
throws DataValidationException
{
try {
- return Long.parseLong(value);
- } catch (NumberFormatException nfe) {
- throw new DataValidationException(invalidDataMessage);
- }
+ return Long.parseLong(value);
+ } catch (NumberFormatException nfe) {
+ throw new DataValidationException(invalidDataMessage);
+ }
}
/**
@@ -365,25 +365,25 @@ public class ParameterUtil
throws DataValidationException
{
try {
- return Float.parseFloat(value);
- } catch (NumberFormatException nfe) {
- throw new DataValidationException(invalidDataMessage);
- }
+ return Float.parseFloat(value);
+ } catch (NumberFormatException nfe) {
+ throw new DataValidationException(invalidDataMessage);
+ }
}
/**
* Internal method to parse a date.
*/
protected static Date parseDateParameter (String value, String invalidDataMessage)
- throws DataValidationException
+ throws DataValidationException
{
- try {
+ try {
synchronized (_dparser) {
return _dparser.parse(value);
}
- } catch (ParseException pe) {
- throw new DataValidationException(invalidDataMessage);
- }
+ } catch (ParseException pe) {
+ throw new DataValidationException(invalidDataMessage);
+ }
}
/** Makes sure integers are within a range. */
diff --git a/src/java/com/samskivert/swing/AbsoluteLayout.java b/src/java/com/samskivert/swing/AbsoluteLayout.java
index 3cff5148..7f9fadd7 100644
--- a/src/java/com/samskivert/swing/AbsoluteLayout.java
+++ b/src/java/com/samskivert/swing/AbsoluteLayout.java
@@ -101,10 +101,10 @@ public class AbsoluteLayout
Dimension dims = new Dimension(rect.width, rect.height);
- // account for the insets
- Insets insets = parent.getInsets();
- dims.width += insets.left + insets.right;
- dims.height += insets.top + insets.bottom;
+ // account for the insets
+ Insets insets = parent.getInsets();
+ dims.width += insets.left + insets.right;
+ dims.height += insets.top + insets.bottom;
return dims;
}
@@ -126,7 +126,7 @@ public class AbsoluteLayout
// documentation inherited from interface
public void layoutContainer (Container parent)
{
- Insets insets = parent.getInsets();
+ Insets insets = parent.getInsets();
int pcount = parent.getComponentCount();
for (int ii = 0; ii < pcount; ii++) {
Component comp = parent.getComponent(ii);
diff --git a/src/java/com/samskivert/swing/DimenInfo.java b/src/java/com/samskivert/swing/DimenInfo.java
index dc53d9e3..19c5fd27 100644
--- a/src/java/com/samskivert/swing/DimenInfo.java
+++ b/src/java/com/samskivert/swing/DimenInfo.java
@@ -50,18 +50,18 @@ public class DimenInfo
@Override
public String toString ()
{
- StringBuilder buf = new StringBuilder();
- buf.append("[count=").append(count);
- buf.append(", totwid=").append(totwid);
- buf.append(", tothei=").append(tothei);
- buf.append(", maxwid=").append(maxwid);
- buf.append(", maxhei=").append(maxhei);
- buf.append(", numfix=").append(numfix);
- buf.append(", fixwid=").append(fixwid);
- buf.append(", fixhei=").append(fixhei);
- buf.append(", maxfreewid=").append(maxfreewid);
- buf.append(", maxfreehei=").append(maxfreehei);
- buf.append(", totweight=").append(totweight);
- return buf.append("]").toString();
+ StringBuilder buf = new StringBuilder();
+ buf.append("[count=").append(count);
+ buf.append(", totwid=").append(totwid);
+ buf.append(", tothei=").append(tothei);
+ buf.append(", maxwid=").append(maxwid);
+ buf.append(", maxhei=").append(maxhei);
+ buf.append(", numfix=").append(numfix);
+ buf.append(", fixwid=").append(fixwid);
+ buf.append(", fixhei=").append(fixhei);
+ buf.append(", maxfreewid=").append(maxfreewid);
+ buf.append(", maxfreehei=").append(maxfreehei);
+ buf.append(", totweight=").append(totweight);
+ return buf.append("]").toString();
}
}
diff --git a/src/java/com/samskivert/swing/GroupLayout.java b/src/java/com/samskivert/swing/GroupLayout.java
index e6d8375e..2935d4f9 100644
--- a/src/java/com/samskivert/swing/GroupLayout.java
+++ b/src/java/com/samskivert/swing/GroupLayout.java
@@ -44,36 +44,33 @@ public abstract class GroupLayout
*/
public static class Constraints
{
- /**
- * Constructs a new constraints object with the specified weight,
+ /**
+ * Constructs a new constraints object with the specified weight,
* which is only applicable with the STRETCH policy.
- */
- public Constraints (int weight)
- {
- _weight = weight;
- }
+ */
+ public Constraints (int weight) {
+ _weight = weight;
+ }
/**
* Is this Constraints specifying fixed?
*/
- public final boolean isFixed ()
- {
+ public final boolean isFixed () {
return (this == FIXED);
}
/**
* Get the weight.
*/
- public final int getWeight ()
- {
+ public final int getWeight () {
return _weight;
}
- /**
- * The weight of this component relative to the other components
- * in the container. Only valid if the layout policy is STRETCH.
- */
- protected int _weight = 1;
+ /**
+ * The weight of this component relative to the other components
+ * in the container. Only valid if the layout policy is STRETCH.
+ */
+ protected int _weight = 1;
}
/** A class used to make our policy constants type-safe. */
@@ -127,108 +124,107 @@ public abstract class GroupLayout
public void setPolicy (Policy policy)
{
- _policy = policy;
+ _policy = policy;
}
public Policy getPolicy ()
{
- return _policy;
+ return _policy;
}
public void setOffAxisPolicy (Policy offpolicy)
{
- _offpolicy = offpolicy;
+ _offpolicy = offpolicy;
}
public Policy getOffAxisPolicy ()
{
- return _offpolicy;
+ return _offpolicy;
}
public void setGap (int gap)
{
- _gap = gap;
+ _gap = gap;
}
public int getGap ()
{
- return _gap;
+ return _gap;
}
public void setJustification (Justification justification)
{
- _justification = justification;
+ _justification = justification;
}
public Justification getJustification ()
{
- return _justification;
+ return _justification;
}
public void setOffAxisJustification (Justification justification)
{
- _offjust = justification;
+ _offjust = justification;
}
public Justification getOffAxisJustification ()
{
- return _offjust;
+ return _offjust;
}
public void addLayoutComponent (String name, Component comp)
{
- // nothing to do here
+ // nothing to do here
}
public void removeLayoutComponent (Component comp)
{
- if (_constraints != null) {
- _constraints.remove(comp);
- }
+ if (_constraints != null) {
+ _constraints.remove(comp);
+ }
}
public void addLayoutComponent (Component comp, Object constraints)
{
- if (constraints != null) {
- if (constraints instanceof Constraints) {
- if (_constraints == null) {
- _constraints = new HashMap();
- }
- _constraints.put(comp, (Constraints)constraints);
+ if (constraints != null) {
+ if (constraints instanceof Constraints) {
+ if (_constraints == null) {
+ _constraints = new HashMap();
+ }
+ _constraints.put(comp, (Constraints)constraints);
- } else {
- throw new RuntimeException("GroupLayout constraints " +
- "object must be of type " +
- "GroupLayout.Constraints");
- }
- }
+ } else {
+ throw new RuntimeException(
+ "GroupLayout constraints object must be of type GroupLayout.Constraints");
+ }
+ }
}
public float getLayoutAlignmentX (Container target)
{
- // we don't support alignment like this
- return 0f;
+ // we don't support alignment like this
+ return 0f;
}
public float getLayoutAlignmentY (Container target)
{
- // we don't support alignment like this
- return 0f;
+ // we don't support alignment like this
+ return 0f;
}
public Dimension minimumLayoutSize (Container parent)
{
- return getLayoutSize(parent, MINIMUM);
+ return getLayoutSize(parent, MINIMUM);
}
public Dimension preferredLayoutSize (Container parent)
{
- return getLayoutSize(parent, PREFERRED);
+ return getLayoutSize(parent, PREFERRED);
}
public Dimension maximumLayoutSize (Container parent)
{
- return getLayoutSize(parent, MAXIMUM);
+ return getLayoutSize(parent, MAXIMUM);
}
protected abstract Dimension getLayoutSize (Container parent, int type);
@@ -237,7 +233,7 @@ public abstract class GroupLayout
public void invalidateLayout (Container target)
{
- // nothing to do here
+ // nothing to do here
}
/**
@@ -261,52 +257,51 @@ public abstract class GroupLayout
* Computes dimensions of the children widgets that are useful for the
* group layout managers.
*/
- protected DimenInfo computeDimens (Container parent, int type)
- {
- int count = parent.getComponentCount();
- DimenInfo info = new DimenInfo();
- info.dimens = new Dimension[count];
+ protected DimenInfo computeDimens (Container parent, int type) {
+ int count = parent.getComponentCount();
+ DimenInfo info = new DimenInfo();
+ info.dimens = new Dimension[count];
- for (int i = 0; i < count; i++) {
- Component child = parent.getComponent(i);
- if (!child.isVisible()) {
- continue;
- }
+ for (int i = 0; i < count; i++) {
+ Component child = parent.getComponent(i);
+ if (!child.isVisible()) {
+ continue;
+ }
- Dimension csize;
- switch (type) {
- case MINIMUM:
- csize = child.getMinimumSize();
- break;
+ Dimension csize;
+ switch (type) {
+ case MINIMUM:
+ csize = child.getMinimumSize();
+ break;
- case MAXIMUM:
- csize = child.getMaximumSize();
- break;
+ case MAXIMUM:
+ csize = child.getMaximumSize();
+ break;
- default:
- csize = child.getPreferredSize();
- break;
- }
+ default:
+ csize = child.getPreferredSize();
+ break;
+ }
- info.count++;
- info.totwid += csize.width;
- info.tothei += csize.height;
+ info.count++;
+ info.totwid += csize.width;
+ info.tothei += csize.height;
- if (csize.width > info.maxwid) {
- info.maxwid = csize.width;
- }
- if (csize.height > info.maxhei) {
- info.maxhei = csize.height;
- }
+ if (csize.width > info.maxwid) {
+ info.maxwid = csize.width;
+ }
+ if (csize.height > info.maxhei) {
+ info.maxhei = csize.height;
+ }
Constraints c = getConstraints(child);
- if (c.isFixed()) {
- info.fixwid += csize.width;
- info.fixhei += csize.height;
- info.numfix++;
+ if (c.isFixed()) {
+ info.fixwid += csize.width;
+ info.fixhei += csize.height;
+ info.numfix++;
- } else {
- info.totweight += c.getWeight();
+ } else {
+ info.totweight += c.getWeight();
if (csize.width > info.maxfreewid) {
info.maxfreewid = csize.width;
@@ -314,12 +309,12 @@ public abstract class GroupLayout
if (csize.height > info.maxfreehei) {
info.maxfreehei = csize.height;
}
- }
+ }
- info.dimens[i] = csize;
- }
+ info.dimens[i] = csize;
+ }
- return info;
+ return info;
}
/**
diff --git a/src/java/com/samskivert/swing/GroupLayoutTest.java b/src/java/com/samskivert/swing/GroupLayoutTest.java
index 6ea1ba6f..146d6151 100644
--- a/src/java/com/samskivert/swing/GroupLayoutTest.java
+++ b/src/java/com/samskivert/swing/GroupLayoutTest.java
@@ -28,33 +28,31 @@ public class GroupLayoutTest
{
public static void main (String[] args)
{
- JFrame frame = new JFrame("GroupLayoutTest");
- JPanel panel = new JPanel();
- GroupLayout layout = new HGroupLayout();
- layout.setJustification(GroupLayout.CENTER);
- layout.setPolicy(GroupLayout.STRETCH);
+ JFrame frame = new JFrame("GroupLayoutTest");
+ JPanel panel = new JPanel();
+ GroupLayout layout = new HGroupLayout();
+ layout.setJustification(GroupLayout.CENTER);
+ layout.setPolicy(GroupLayout.STRETCH);
layout.setJustification(GroupLayout.RIGHT);
- layout.setGap(15);
- panel.setLayout(layout);
+ layout.setGap(15);
+ panel.setLayout(layout);
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
- JButton butone = new JButton("One");
- panel.add(butone, GroupLayout.FIXED);
- JButton buttwo = new JButton("Two");
- panel.add(buttwo, GroupLayout.FIXED);
- JButton butthree = new JButton("Three to get ready");
- panel.add(butthree, GroupLayout.FIXED);
+ JButton butone = new JButton("One");
+ panel.add(butone, GroupLayout.FIXED);
+ JButton buttwo = new JButton("Two");
+ panel.add(buttwo, GroupLayout.FIXED);
+ JButton butthree = new JButton("Three to get ready");
+ panel.add(butthree, GroupLayout.FIXED);
- frame.addWindowListener(new WindowAdapter ()
- {
- @Override public void windowClosing (WindowEvent e)
- {
+ frame.addWindowListener(new WindowAdapter () {
+ @Override public void windowClosing (WindowEvent e) {
System.exit(0);
}
});
frame.getContentPane().add(panel, BorderLayout.CENTER);
- frame.pack();
- frame.setVisible(true);
+ frame.pack();
+ frame.setVisible(true);
}
}
diff --git a/src/java/com/samskivert/swing/HGroupLayout.java b/src/java/com/samskivert/swing/HGroupLayout.java
index 18718031..aba51640 100644
--- a/src/java/com/samskivert/swing/HGroupLayout.java
+++ b/src/java/com/samskivert/swing/HGroupLayout.java
@@ -24,31 +24,30 @@ import java.awt.*;
public class HGroupLayout extends GroupLayout
{
- public HGroupLayout (Policy policy, Policy offpolicy, int gap,
- Justification justification)
+ public HGroupLayout (Policy policy, Policy offpolicy, int gap, Justification justification)
{
- _policy = policy;
- _offpolicy = offpolicy;
- _gap = gap;
- _justification = justification;
+ _policy = policy;
+ _offpolicy = offpolicy;
+ _gap = gap;
+ _justification = justification;
}
public HGroupLayout (Policy policy, int gap, Justification justification)
{
- _policy = policy;
- _gap = gap;
- _justification = justification;
+ _policy = policy;
+ _gap = gap;
+ _justification = justification;
}
public HGroupLayout (Policy policy, Justification justification)
{
- _policy = policy;
- _justification = justification;
+ _policy = policy;
+ _justification = justification;
}
public HGroupLayout (Policy policy)
{
- _policy = policy;
+ _policy = policy;
}
public HGroupLayout ()
@@ -58,126 +57,124 @@ public class HGroupLayout extends GroupLayout
@Override
protected Dimension getLayoutSize (Container parent, int type)
{
- DimenInfo info = computeDimens(parent, type);
- Dimension dims = new Dimension();
+ DimenInfo info = computeDimens(parent, type);
+ Dimension dims = new Dimension();
if (_policy == STRETCH) {
- dims.width = info.maxfreewid * (info.count - info.numfix) +
- info.fixwid;
+ dims.width = info.maxfreewid * (info.count - info.numfix) + info.fixwid;
} else if (_policy == EQUALIZE) {
- dims.width = info.maxwid * info.count;
+ dims.width = info.maxwid * info.count;
} else { // NONE or CONSTRAIN
- dims.width = info.totwid;
- }
+ dims.width = info.totwid;
+ }
- dims.width += (info.count - 1) * _gap;
- dims.height = info.maxhei;
+ dims.width += (info.count - 1) * _gap;
+ dims.height = info.maxhei;
- // account for the insets
- Insets insets = parent.getInsets();
- dims.width += insets.left + insets.right;
- dims.height += insets.top + insets.bottom;
+ // account for the insets
+ Insets insets = parent.getInsets();
+ dims.width += insets.left + insets.right;
+ dims.height += insets.top + insets.bottom;
- return dims;
+ return dims;
}
@Override
public void layoutContainer (Container parent)
{
- Rectangle b = parent.getBounds();
- DimenInfo info = computeDimens(parent, PREFERRED);
+ Rectangle b = parent.getBounds();
+ DimenInfo info = computeDimens(parent, PREFERRED);
- // adjust the bounds width and height to account for the insets
- Insets insets = parent.getInsets();
- b.width -= (insets.left + insets.right);
- b.height -= (insets.top + insets.bottom);
+ // adjust the bounds width and height to account for the insets
+ Insets insets = parent.getInsets();
+ b.width -= (insets.left + insets.right);
+ b.height -= (insets.top + insets.bottom);
- int nk = parent.getComponentCount();
- int sx, sy;
- int totwid, totgap = _gap * (info.count-1);
- int freecount = info.count - info.numfix;
+ int nk = parent.getComponentCount();
+ int sx, sy;
+ int totwid, totgap = _gap * (info.count-1);
+ int freecount = info.count - info.numfix;
// when stretching, there is the possibility that a pixel or more
// will be lost to rounding error. we account for that here and
// assign the extra space to the first free component
int freefrac = 0;
- // do the on-axis policy calculations
- int defwid = 0;
+ // do the on-axis policy calculations
+ int defwid = 0;
if (_policy == STRETCH) {
- if (freecount > 0) {
+ if (freecount > 0) {
int freewid = b.width - info.fixwid - totgap;
defwid = freewid / info.totweight;
freefrac = freewid % info.totweight;
- totwid = b.width;
- } else {
- totwid = info.fixwid + totgap;
- }
+ totwid = b.width;
+ } else {
+ totwid = info.fixwid + totgap;
+ }
} else if (_policy == EQUALIZE) {
- defwid = info.maxwid;
- totwid = info.fixwid + defwid * freecount + totgap;
+ defwid = info.maxwid;
+ totwid = info.fixwid + defwid * freecount + totgap;
} else { // NONE or CONSTRAIN
- totwid = info.totwid + totgap;
- }
+ totwid = info.totwid + totgap;
+ }
- // do the off-axis policy calculations
- int defhei = 0;
- if (_offpolicy == STRETCH) {
- defhei = b.height;
+ // do the off-axis policy calculations
+ int defhei = 0;
+ if (_offpolicy == STRETCH) {
+ defhei = b.height;
} else if (_offpolicy == EQUALIZE) {
- defhei = info.maxhei;
- }
+ defhei = info.maxhei;
+ }
- // do the justification-related calculations
- if (_justification == LEFT || _justification == TOP) {
+ // do the justification-related calculations
+ if (_justification == LEFT || _justification == TOP) {
sx = insets.left;
} else if (_justification == CENTER) {
- sx = insets.left + (b.width - totwid)/2;
+ sx = insets.left + (b.width - totwid)/2;
} else { // RIGHT or BOTTOM
- sx = insets.left + b.width - totwid;
- }
+ sx = insets.left + b.width - totwid;
+ }
- // do the layout
- for (int i = 0; i < nk; i++) {
- // skip non-visible kids
- if (info.dimens[i] == null) {
- continue;
- }
+ // do the layout
+ for (int i = 0; i < nk; i++) {
+ // skip non-visible kids
+ if (info.dimens[i] == null) {
+ continue;
+ }
- Component child = parent.getComponent(i);
+ Component child = parent.getComponent(i);
Constraints c = getConstraints(child);
- int newwid, newhei;
+ int newwid, newhei;
- if (_policy == NONE || c.isFixed()) {
- newwid = info.dimens[i].width;
- } else {
- newwid = freefrac +
- ((_policy == STRETCH) ? defwid * c.getWeight() : defwid);
+ if (_policy == NONE || c.isFixed()) {
+ newwid = info.dimens[i].width;
+ } else {
+ newwid = freefrac + ((_policy == STRETCH) ? defwid * c.getWeight() : defwid);
// clear out the extra pixels the first time they're used
freefrac = 0;
}
- if (_offpolicy == NONE) {
- newhei = info.dimens[i].height;
+ if (_offpolicy == NONE) {
+ newhei = info.dimens[i].height;
} else if (_offpolicy == CONSTRAIN) {
- newhei = Math.min(info.dimens[i].height, b.height);
- } else {
+ newhei = Math.min(info.dimens[i].height, b.height);
+ } else {
newhei = defhei;
}
// determine our off-axis position
if (_offjust == LEFT || _offjust == TOP) {
- sy = insets.top;
+ sy = insets.top;
} else if (_offjust == RIGHT || _offjust == BOTTOM) {
- sy = insets.top + b.height - newhei;
+ sy = insets.top + b.height - newhei;
} else { // CENTER
- sy = insets.top + (b.height - newhei)/2;
+ sy = insets.top + (b.height - newhei)/2;
}
- child.setBounds(sx, sy, newwid, newhei);
- sx += child.getSize().width + _gap;
- }
+ child.setBounds(sx, sy, newwid, newhei);
+ sx += child.getSize().width + _gap;
+ }
}
}
diff --git a/src/java/com/samskivert/swing/VGroupLayout.java b/src/java/com/samskivert/swing/VGroupLayout.java
index 0f239b16..1e1b99eb 100644
--- a/src/java/com/samskivert/swing/VGroupLayout.java
+++ b/src/java/com/samskivert/swing/VGroupLayout.java
@@ -24,31 +24,30 @@ import java.awt.*;
public class VGroupLayout extends GroupLayout
{
- public VGroupLayout (Policy policy, Policy offpolicy, int gap,
- Justification justification)
+ public VGroupLayout (Policy policy, Policy offpolicy, int gap, Justification justification)
{
- _policy = policy;
- _offpolicy = offpolicy;
- _gap = gap;
- _justification = justification;
+ _policy = policy;
+ _offpolicy = offpolicy;
+ _gap = gap;
+ _justification = justification;
}
public VGroupLayout (Policy policy, int gap, Justification justification)
{
- _policy = policy;
- _gap = gap;
- _justification = justification;
+ _policy = policy;
+ _gap = gap;
+ _justification = justification;
}
public VGroupLayout (Policy policy, Justification justification)
{
- _policy = policy;
- _justification = justification;
+ _policy = policy;
+ _justification = justification;
}
public VGroupLayout (Policy policy)
{
- _policy = policy;
+ _policy = policy;
}
public VGroupLayout ()
@@ -58,44 +57,43 @@ public class VGroupLayout extends GroupLayout
@Override
protected Dimension getLayoutSize (Container parent, int type)
{
- DimenInfo info = computeDimens(parent, type);
- Dimension dims = new Dimension();
+ DimenInfo info = computeDimens(parent, type);
+ Dimension dims = new Dimension();
if (_policy == STRETCH) {
- dims.height = info.maxfreehei * (info.count - info.numfix) +
- info.fixhei;
+ dims.height = info.maxfreehei * (info.count - info.numfix) + info.fixhei;
} else if (_policy == EQUALIZE) {
- dims.height = info.maxhei * info.count;
+ dims.height = info.maxhei * info.count;
} else { // NONE or CONSTRAIN
- dims.height = info.tothei;
- }
+ dims.height = info.tothei;
+ }
dims.height += (info.count - 1) * _gap;
- dims.width = info.maxwid;
+ dims.width = info.maxwid;
- // account for the insets
- Insets insets = parent.getInsets();
- dims.width += insets.left + insets.right;
- dims.height += insets.top + insets.bottom;
+ // account for the insets
+ Insets insets = parent.getInsets();
+ dims.width += insets.left + insets.right;
+ dims.height += insets.top + insets.bottom;
- return dims;
+ return dims;
}
@Override
public void layoutContainer (Container parent)
{
- Rectangle b = parent.getBounds();
- DimenInfo info = computeDimens(parent, PREFERRED);
+ Rectangle b = parent.getBounds();
+ DimenInfo info = computeDimens(parent, PREFERRED);
- // adjust the bounds width and height to account for the insets
- Insets insets = parent.getInsets();
- b.width -= (insets.left + insets.right);
- b.height -= (insets.top + insets.bottom);
+ // adjust the bounds width and height to account for the insets
+ Insets insets = parent.getInsets();
+ b.width -= (insets.left + insets.right);
+ b.height -= (insets.top + insets.bottom);
- int nk = parent.getComponentCount();
- int sx, sy;
- int tothei, totgap = _gap * (info.count-1);
- int freecount = info.count - info.numfix;
+ int nk = parent.getComponentCount();
+ int sx, sy;
+ int tothei, totgap = _gap * (info.count-1);
+ int freecount = info.count - info.numfix;
// when stretching, there is the possibility that a pixel or more
// will be lost to rounding error. we account for that here and
@@ -103,81 +101,80 @@ public class VGroupLayout extends GroupLayout
int freefrac = 0;
// do the on-axis policy calculations
- int defhei = 0;
+ int defhei = 0;
if (_policy == STRETCH) {
- if (freecount > 0) {
+ if (freecount > 0) {
int freehei = b.height - info.fixhei - totgap;
defhei = freehei / info.totweight;
freefrac = freehei % info.totweight;
- tothei = b.height;
- } else {
- tothei = info.fixhei + totgap;
- }
+ tothei = b.height;
+ } else {
+ tothei = info.fixhei + totgap;
+ }
} else if (_policy == EQUALIZE) {
- defhei = info.maxhei;
- tothei = info.fixhei + defhei * freecount + totgap;
+ defhei = info.maxhei;
+ tothei = info.fixhei + defhei * freecount + totgap;
} else {
- tothei = info.tothei + totgap;
- }
+ tothei = info.tothei + totgap;
+ }
- // do the off-axis policy calculations
- int defwid = 0;
+ // do the off-axis policy calculations
+ int defwid = 0;
if (_offpolicy == STRETCH) {
- defwid = b.width;
+ defwid = b.width;
} else if (_offpolicy == EQUALIZE) {
- defwid = info.maxwid;
- }
+ defwid = info.maxwid;
+ }
- // do the justification-related calculations
+ // do the justification-related calculations
if (_justification == LEFT || _justification == TOP) {
sy = insets.top;
} else if (_justification == CENTER) {
- sy = insets.top + (b.height - tothei)/2;
+ sy = insets.top + (b.height - tothei)/2;
} else { // RIGHT or BOTTOM
- sy = insets.top + b.height - tothei;
- }
+ sy = insets.top + b.height - tothei;
+ }
- // do the layout
- for (int i = 0; i < nk; i++) {
- // skip non-visible kids
- if (info.dimens[i] == null) {
- continue;
- }
+ // do the layout
+ for (int i = 0; i < nk; i++) {
+ // skip non-visible kids
+ if (info.dimens[i] == null) {
+ continue;
+ }
- Component child = parent.getComponent(i);
+ Component child = parent.getComponent(i);
Constraints c = getConstraints(child);
- int newwid, newhei;
+ int newwid, newhei;
- if (_policy == NONE || c.isFixed()) {
- newhei = info.dimens[i].height;
- } else {
- newhei = freefrac +
- ((_policy == STRETCH) ? defhei * c.getWeight() : defhei);
+ if (_policy == NONE || c.isFixed()) {
+ newhei = info.dimens[i].height;
+ } else {
+ newhei = freefrac + ((_policy == STRETCH) ? defhei * c.getWeight() : defhei);
// clear out the extra pixels the first time they're used
freefrac = 0;
}
- if (_offpolicy == NONE) {
- newwid = info.dimens[i].width;
+ if (_offpolicy == NONE) {
+ newwid = info.dimens[i].width;
} else if (_offpolicy == CONSTRAIN) {
- newwid = Math.min(info.dimens[i].width, b.width);
- } else {
+ newwid = Math.min(info.dimens[i].width, b.width);
+ } else {
newwid = defwid;
}
// determine our off-axis position
if (_offjust == LEFT || _offjust == TOP) {
- sx = insets.left;
+ sx = insets.left;
} else if (_offjust == RIGHT || _offjust == BOTTOM) {
- sx = insets.left + b.width - newwid;
+ sx = insets.left + b.width - newwid;
} else { // CENTER
- sx = insets.left + (b.width - newwid)/2;
+ sx = insets.left + (b.width - newwid)/2;
}
- child.setBounds(sx, sy, newwid, newhei);
- sy += child.getSize().height + _gap;
- }
+ child.setBounds(sx, sy, newwid, newhei);
+ sy += child.getSize().height + _gap;
+ }
}
}
diff --git a/src/java/com/samskivert/swing/util/MenuUtil.java b/src/java/com/samskivert/swing/util/MenuUtil.java
index 7788ee0b..136d7f4c 100644
--- a/src/java/com/samskivert/swing/util/MenuUtil.java
+++ b/src/java/com/samskivert/swing/util/MenuUtil.java
@@ -62,7 +62,7 @@ public class MenuUtil
KeyStroke accel)
{
JMenuItem item = createItem(name, mnem, accel);
- item.addActionListener(l);
+ item.addActionListener(l);
menu.add(item);
return item;
}
@@ -127,19 +127,16 @@ public class MenuUtil
* @param name the item name.
* @param mnem the mnemonic key for the item.
* @param accel the keystroke for the item or null if none.
- * @param target the object on which to invoke a method when the menu
- * is selected.
- * @param callbackName the name of the method to invoke when the menu
- * is selected.
+ * @param target the object on which to invoke a method when the menu is selected.
+ * @param callbackName the name of the method to invoke when the menu is selected.
*
* @return the new menu item.
*/
public static JMenuItem addMenuItem (
- JMenu menu, String name, int mnem, KeyStroke accel,
- Object target, String callbackName)
+ JMenu menu, String name, int mnem, KeyStroke accel, Object target, String callbackName)
{
- JMenuItem item = createItem(name, Integer.valueOf(mnem), accel);
- item.addActionListener(new ReflectedAction(target, callbackName));
+ JMenuItem item = createItem(name, Integer.valueOf(mnem), accel);
+ item.addActionListener(new ReflectedAction(target, callbackName));
menu.add(item);
return item;
}
@@ -152,18 +149,16 @@ public class MenuUtil
*
* @param menu the menu to add the item to.
* @param name the item name.
- * @param target the object on which to invoke a method when the menu
- * is selected.
- * @param callbackName the name of the method to invoke when the menu
- * is selected.
+ * @param target the object on which to invoke a method when the menu is selected.
+ * @param callbackName the name of the method to invoke when the menu is selected.
*
* @return the new menu item.
*/
public static JMenuItem addMenuItem (
JMenu menu, String name, Object target, String callbackName)
{
- JMenuItem item = createItem(name, null, null);
- item.addActionListener(new ReflectedAction(target, callbackName));
+ JMenuItem item = createItem(name, null, null);
+ item.addActionListener(new ReflectedAction(target, callbackName));
menu.add(item);
return item;
}
@@ -181,17 +176,15 @@ public class MenuUtil
*
* @param menu the menu to add the item to.
* @param name the item name.
- * @param target the object on which to invoke a method when the menu
- * is selected.
- * @param callbackName the name of the method to invoke when the menu
- * is selected.
+ * @param target the object on which to invoke a method when the menu is selected.
+ * @param callbackName the name of the method to invoke when the menu is selected.
*
* @return the new menu item.
*/
public static JMenuItem addMenuItem (
JPopupMenu menu, String name, Object target, String callbackName)
{
- JMenuItem item = createItem(name, null, null);
+ JMenuItem item = createItem(name, null, null);
item.addActionListener(new ReflectedAction(target, callbackName));
menu.add(item);
return item;
@@ -200,10 +193,9 @@ public class MenuUtil
/**
* Creates and configures a menu item.
*/
- protected static JMenuItem createItem (
- String name, Integer mnem, KeyStroke accel)
+ protected static JMenuItem createItem (String name, Integer mnem, KeyStroke accel)
{
- JMenuItem item = new JMenuItem(name);
+ JMenuItem item = new JMenuItem(name);
if (mnem != null) {
item.setMnemonic(mnem.intValue());
}
@@ -218,8 +210,7 @@ public class MenuUtil
*/
protected static class ReflectedAction implements ActionListener
{
- public ReflectedAction (Object target, String methodName)
- {
+ public ReflectedAction (Object target, String methodName) {
try {
// look up the method we'll be calling
_method = target.getClass().getMethod(methodName, METHOD_ARGS);
@@ -231,8 +222,7 @@ public class MenuUtil
}
}
- public void actionPerformed (ActionEvent event)
- {
+ public void actionPerformed (ActionEvent event) {
if (_method != null) {
try {
_method.invoke(_target, new Object[] { event });
diff --git a/src/java/com/samskivert/swing/util/ProximityTracker.java b/src/java/com/samskivert/swing/util/ProximityTracker.java
index 88d0e074..6943f563 100644
--- a/src/java/com/samskivert/swing/util/ProximityTracker.java
+++ b/src/java/com/samskivert/swing/util/ProximityTracker.java
@@ -231,26 +231,25 @@ public class ProximityTracker
*/
protected int binarySearch (int x)
{
- // copied from java.util.Arrays which I wouldn't have to have done
- // had the provided a means by which to binarySearch in a subset
- // of an array. alas.
- int low = 0;
- int high = _size-1;
+ // copied from java.util.Arrays which I wouldn't have to have done had the provided a
+ // means by which to binarySearch in a subset of an array. alas.
+ int low = 0;
+ int high = _size-1;
- while (low <= high) {
- int mid = (low + high) >>> 1;
- int cmp = (_records[mid].x - x);
+ while (low <= high) {
+ int mid = (low + high) >>> 1;
+ int cmp = (_records[mid].x - x);
- if (cmp < 0) {
- low = mid + 1;
- } else if (cmp > 0) {
- high = mid - 1;
- } else {
- return mid; // key found
+ if (cmp < 0) {
+ low = mid + 1;
+ } else if (cmp > 0) {
+ high = mid - 1;
+ } else {
+ return mid; // key found
}
- }
+ }
- return low; // key not found
+ return low; // key not found
}
/**
diff --git a/src/java/com/samskivert/swing/util/SwingUtil.java b/src/java/com/samskivert/swing/util/SwingUtil.java
index e04301d1..33f16592 100644
--- a/src/java/com/samskivert/swing/util/SwingUtil.java
+++ b/src/java/com/samskivert/swing/util/SwingUtil.java
@@ -143,9 +143,9 @@ public class SwingUtil
Graphics g, String str, int x, int y, int width, int height)
{
FontMetrics fm = g.getFontMetrics(g.getFont());
- int xpos = x + ((width - fm.stringWidth(str)) / 2);
- int ypos = y + ((height + fm.getAscent()) / 2);
- g.drawString(str, xpos, ypos);
+ int xpos = x + ((width - fm.stringWidth(str)) / 2);
+ int ypos = y + ((height + fm.getAscent()) / 2);
+ g.drawString(str, xpos, ypos);
}
/**
diff --git a/src/java/com/samskivert/swing/util/TaskMaster.java b/src/java/com/samskivert/swing/util/TaskMaster.java
index 8f8dbfff..727c2ea1 100644
--- a/src/java/com/samskivert/swing/util/TaskMaster.java
+++ b/src/java/com/samskivert/swing/util/TaskMaster.java
@@ -47,14 +47,13 @@ public class TaskMaster
* subsequent dealings with the task master. The supplied observer (if
* non-null) will be notified when the task has completed.
*/
- public static void invokeTask (String name, Task task,
- TaskObserver observer)
+ public static void invokeTask (String name, Task task, TaskObserver observer)
{
- // create a task runner and stick it in our task table
- TaskRunner runner = new TaskRunner(name, task, observer);
- _tasks.put(name, runner);
- // then start the runner up
- runner.start();
+ // create a task runner and stick it in our task table
+ TaskRunner runner = new TaskRunner(name, task, observer);
+ _tasks.put(name, runner);
+ // then start the runner up
+ runner.start();
}
/**
@@ -65,8 +64,7 @@ public class TaskMaster
* invoke method of the Task interface.
* Aborting tasks run in this way is not supported.
*/
- public static void invokeMethodTask (String name, Object source,
- TaskObserver observer)
+ public static void invokeMethodTask (String name, Object source, TaskObserver observer)
{
// create a method task instance to invoke the named method and
// then run that through the normal task invocation mechanism
@@ -79,29 +77,25 @@ public class TaskMaster
*/
protected static void removeTask (String name)
{
- _tasks.remove(name);
+ _tasks.remove(name);
}
protected static class TaskRunner extends Thread
{
- public TaskRunner (String name, Task task, TaskObserver observer)
- {
- _name = name;
- _task = task;
- _observer = observer;
+ public TaskRunner (String name, Task task, TaskObserver observer) {
+ _name = name;
+ _task = task;
+ _observer = observer;
_mode = INVOKE;
- }
+ }
/**
- * Invokes the task and then reports completion or failure later
- * on the swing event dispatcher thread. We need to ensure that
- * _mode and _result are visible to the various threads that
- * invoke this runnable so run() is synchronized. Oh how I love
- * Chapter 17.
+ * Invokes the task and then reports completion or failure later on the swing event
+ * dispatcher thread. We need to ensure that _mode and _result are visible to the various
+ * threads that invoke this runnable so run() is synchronized. Oh how I love Chapter 17.
*/
- @Override
- public synchronized void run ()
- {
+ @Override
+ public synchronized void run () {
switch (_mode) {
default:
case INVOKE:
@@ -139,19 +133,18 @@ public class TaskMaster
}
break;
}
- }
+ }
- public void abort ()
- {
- log.warning("abort() not currently supported.");
- }
+ public void abort () {
+ log.warning("abort() not currently supported.");
+ }
- protected String _name;
- protected Task _task;
- protected TaskObserver _observer;
+ protected String _name;
+ protected Task _task;
+ protected TaskObserver _observer;
protected int _mode;
- protected Object _result;
+ protected Object _result;
protected static final int INVOKE = 0;
protected static final int COMPLETED = 1;
@@ -160,22 +153,19 @@ public class TaskMaster
protected static class MethodTask implements Task
{
- public MethodTask (String name, Object source)
- {
+ public MethodTask (String name, Object source) {
_name = name;
_source = source;
}
- public Object invoke () throws Exception
- {
+ public Object invoke () throws Exception {
// look up the named method on the source object and invoke it
Method meth = _source.getClass().getMethod(_name, (Class>[]) null);
meth.setAccessible(true);
return meth.invoke(_source, (Object[]) null);
}
- public boolean abort ()
- {
+ public boolean abort () {
// aborting not supported
return false;
}
@@ -184,6 +174,5 @@ public class TaskMaster
protected Object _source;
}
- protected static Hashtable _tasks =
- new Hashtable();
+ protected static Hashtable _tasks = new Hashtable();
}
diff --git a/src/java/com/samskivert/util/Comparators.java b/src/java/com/samskivert/util/Comparators.java
index 3caef8cf..017fb21c 100644
--- a/src/java/com/samskivert/util/Comparators.java
+++ b/src/java/com/samskivert/util/Comparators.java
@@ -86,7 +86,7 @@ public class Comparators
*/
public static int compare (byte value1, byte value2)
{
- return (value1 < value2 ? -1 : (value1 == value2 ? 0 : 1));
+ return (value1 < value2 ? -1 : (value1 == value2 ? 0 : 1));
}
/**
@@ -95,7 +95,7 @@ public class Comparators
*/
public static int compare (char value1, char value2)
{
- return (value1 < value2 ? -1 : (value1 == value2 ? 0 : 1));
+ return (value1 < value2 ? -1 : (value1 == value2 ? 0 : 1));
}
/**
@@ -104,7 +104,7 @@ public class Comparators
*/
public static int compare (short value1, short value2)
{
- return (value1 < value2 ? -1 : (value1 == value2 ? 0 : 1));
+ return (value1 < value2 ? -1 : (value1 == value2 ? 0 : 1));
}
/**
@@ -113,7 +113,7 @@ public class Comparators
*/
public static int compare (int value1, int value2)
{
- return (value1 < value2 ? -1 : (value1 == value2 ? 0 : 1));
+ return (value1 < value2 ? -1 : (value1 == value2 ? 0 : 1));
}
/**
@@ -122,7 +122,7 @@ public class Comparators
*/
public static int compare (long value1, long value2)
{
- return (value1 < value2 ? -1 : (value1 == value2 ? 0 : 1));
+ return (value1 < value2 ? -1 : (value1 == value2 ? 0 : 1));
}
/**
diff --git a/src/java/com/samskivert/util/Config.java b/src/java/com/samskivert/util/Config.java
index 45a55f27..4a911e4f 100644
--- a/src/java/com/samskivert/util/Config.java
+++ b/src/java/com/samskivert/util/Config.java
@@ -350,9 +350,9 @@ public class Config
* @exception Exception thrown if any error occurs while loading or instantiating the class.
*/
public Object instantiateValue (String name, String defcname)
- throws Exception
+ throws Exception
{
- return Class.forName(getValue(name, defcname)).newInstance();
+ return Class.forName(getValue(name, defcname)).newInstance();
}
/**
diff --git a/src/java/com/samskivert/util/ConfigUtil.java b/src/java/com/samskivert/util/ConfigUtil.java
index 0bab558f..aeb5bf05 100644
--- a/src/java/com/samskivert/util/ConfigUtil.java
+++ b/src/java/com/samskivert/util/ConfigUtil.java
@@ -69,9 +69,9 @@ public class ConfigUtil
* be found, null otherwise.
*/
public static Properties loadProperties (String path)
- throws IOException
+ throws IOException
{
- return loadProperties(path, ConfigUtil.class.getClassLoader());
+ return loadProperties(path, ConfigUtil.class.getClassLoader());
}
/**
@@ -79,22 +79,21 @@ public class ConfigUtil
* than the class loader used to load the ConfigUtil class.
*/
public static Properties loadProperties (String path, ClassLoader loader)
- throws IOException
+ throws IOException
{
- Properties props = new Properties();
+ Properties props = new Properties();
loadProperties(path, loader, props);
- return props;
+ return props;
}
/**
* Like {@link #loadProperties(String,ClassLoader)} but the properties are loaded into the
* supplied {@link Properties} object.
*/
- public static void loadProperties (
- String path, ClassLoader loader, Properties target)
- throws IOException
+ public static void loadProperties (String path, ClassLoader loader, Properties target)
+ throws IOException
{
- InputStream in = getStream(path, loader);
+ InputStream in = getStream(path, loader);
if (in == null) {
throw new FileNotFoundException(path);
}
@@ -218,9 +217,9 @@ public class ConfigUtil
* be found, null otherwise.
*/
public static Properties loadInheritedProperties (String path)
- throws IOException
+ throws IOException
{
- return loadInheritedProperties(path, ConfigUtil.class.getClassLoader());
+ return loadInheritedProperties(path, ConfigUtil.class.getClassLoader());
}
/**
@@ -228,7 +227,7 @@ public class ConfigUtil
* target object.
*/
public static void loadInheritedProperties (String path, Properties target)
- throws IOException
+ throws IOException
{
loadInheritedProperties(path, ConfigUtil.class.getClassLoader(), target);
}
@@ -238,7 +237,7 @@ public class ConfigUtil
* rather than the class loader used to load the ConfigUtil class.
*/
public static Properties loadInheritedProperties (String path, ClassLoader loader)
- throws IOException
+ throws IOException
{
Properties props = new Properties();
loadInheritedProperties(path, loader, props);
@@ -254,7 +253,7 @@ public class ConfigUtil
* path.
*/
public static void loadInheritedProperties (String path, ClassLoader loader, Properties target)
- throws IOException
+ throws IOException
{
// first look for the files in the supplied class loader
Enumeration enm = getResources(path, loader);
@@ -486,7 +485,7 @@ public class ConfigUtil
*/
public static InputStream getStream (String path)
{
- return getStream(path, ConfigUtil.class.getClassLoader());
+ return getStream(path, ConfigUtil.class.getClassLoader());
}
/**
@@ -499,14 +498,14 @@ public class ConfigUtil
*/
public static InputStream getStream (String path, ClassLoader loader)
{
- // first try the supplied class loader
- InputStream in = getResourceAsStream(path, loader);
- if (in != null) {
- return in;
- }
+ // first try the supplied class loader
+ InputStream in = getResourceAsStream(path, loader);
+ if (in != null) {
+ return in;
+ }
- // if that didn't work, try the system class loader (but only if it's different from the
- // class loader we just tried)
+ // if that didn't work, try the system class loader (but only if it's different from the
+ // class loader we just tried)
try {
ClassLoader sysloader = ClassLoader.getSystemClassLoader();
if (sysloader != loader) {
@@ -526,12 +525,12 @@ public class ConfigUtil
return null;
}
// try the path as is
- InputStream in = loader.getResourceAsStream(path);
- if (in != null) {
- return in;
- }
- // try toggling the leading slash
- return loader.getResourceAsStream(togglePath(path));
+ InputStream in = loader.getResourceAsStream(path);
+ if (in != null) {
+ return in;
+ }
+ // try toggling the leading slash
+ return loader.getResourceAsStream(togglePath(path));
}
protected static Enumeration getResources (String path, ClassLoader loader)
@@ -543,21 +542,21 @@ public class ConfigUtil
return null;
}
// try the path as is
- Enumeration enm = loader.getResources(path);
- if (enm.hasMoreElements()) {
- return enm;
- }
- // try toggling the leading slash
- return loader.getResources(togglePath(path));
+ Enumeration enm = loader.getResources(path);
+ if (enm.hasMoreElements()) {
+ return enm;
+ }
+ // try toggling the leading slash
+ return loader.getResources(togglePath(path));
}
protected static String togglePath (String path)
{
- if (path.startsWith("/")) {
- return path.substring(1);
- } else {
- return "/" + path;
- }
+ if (path.startsWith("/")) {
+ return path.substring(1);
+ } else {
+ return "/" + path;
+ }
}
/** Used when parsing inherited properties. */
diff --git a/src/java/com/samskivert/util/IntIntMap.java b/src/java/com/samskivert/util/IntIntMap.java
index a8a339cb..c67bc36c 100644
--- a/src/java/com/samskivert/util/IntIntMap.java
+++ b/src/java/com/samskivert/util/IntIntMap.java
@@ -58,7 +58,7 @@ public class IntIntMap
public IntIntMap (int buckets, float loadFactor)
{
- _buckets = new Record[buckets];
+ _buckets = new Record[buckets];
_loadFactor = loadFactor;
}
@@ -69,7 +69,7 @@ public class IntIntMap
public IntIntMap ()
{
- this(DEFAULT_BUCKETS, DEFAULT_LOAD_FACTOR);
+ this(DEFAULT_BUCKETS, DEFAULT_LOAD_FACTOR);
}
public boolean isEmpty ()
@@ -82,7 +82,7 @@ public class IntIntMap
*/
public int size ()
{
- return _size;
+ return _size;
}
/**
@@ -96,28 +96,28 @@ public class IntIntMap
ensureCapacity(_size + 1);
int index = Math.abs(key)%_buckets.length;
- Record rec = _buckets[index];
+ Record rec = _buckets[index];
- // either we start a new chain
- if (rec == null) {
- _buckets[index] = new Record(key, value);
- _size++; // we're bigger
- return;
- }
+ // either we start a new chain
+ if (rec == null) {
+ _buckets[index] = new Record(key, value);
+ _size++; // we're bigger
+ return;
+ }
- // or we replace an element in an existing chain
- Record prev = rec;
- for (; rec != null; rec = rec.next) {
- if (rec.key == key) {
- rec.value = value; // we're not bigger
- return;
- }
- prev = rec;
- }
+ // or we replace an element in an existing chain
+ Record prev = rec;
+ for (; rec != null; rec = rec.next) {
+ if (rec.key == key) {
+ rec.value = value; // we're not bigger
+ return;
+ }
+ prev = rec;
+ }
- // or we append it to this chain
- prev.next = new Record(key, value);
- _size++; // we're bigger
+ // or we append it to this chain
+ prev.next = new Record(key, value);
+ _size++; // we're bigger
}
/**
@@ -206,12 +206,12 @@ public class IntIntMap
{
_modCount++;
- // abandon all of our hash chains (the joy of garbage collection)
- for (int i = 0; i < _buckets.length; i++) {
- _buckets[i] = null;
- }
- // zero out our size
- _size = 0;
+ // abandon all of our hash chains (the joy of garbage collection)
+ for (int i = 0; i < _buckets.length; i++) {
+ _buckets[i] = null;
+ }
+ // zero out our size
+ _size = 0;
}
/**
@@ -234,12 +234,12 @@ public class IntIntMap
*/
protected Record locateRecord (int key)
{
- int index = Math.abs(key)%_buckets.length;
- for (Record rec = _buckets[index]; rec != null; rec = rec.next) {
- if (rec.key == key) {
+ int index = Math.abs(key)%_buckets.length;
+ for (Record rec = _buckets[index]; rec != null; rec = rec.next) {
+ if (rec.key == key) {
return rec;
- }
- }
+ }
+ }
return null;
}
@@ -248,7 +248,7 @@ public class IntIntMap
*/
protected int removeImpl (int key, int defval)
{
- int index = Math.abs(key)%_buckets.length;
+ int index = Math.abs(key)%_buckets.length;
Record prev = null;
// go through the chain looking for a match
@@ -445,15 +445,14 @@ public class IntIntMap
protected static class Record implements IntIntEntry
{
- public Record next;
- public int key;
- public int value;
+ public Record next;
+ public int key;
+ public int value;
- public Record (int key, int value)
- {
- this.key = key;
- this.value = value;
- }
+ public Record (int key, int value) {
+ this.key = key;
+ this.value = value;
+ }
public Integer getKey () {
return Integer.valueOf(key);
@@ -497,29 +496,29 @@ public class IntIntMap
class IntEntryIterator implements Iterator
{
- public IntEntryIterator () {
+ public IntEntryIterator () {
this._modCount = IntIntMap.this._modCount;
- _index = _buckets.length;
- }
+ _index = _buckets.length;
+ }
- public boolean hasNext () {
+ public boolean hasNext () {
checkMods();
- // if we're pointing to an entry, we've got more entries
- if (_next != null) {
- return true;
- }
- // search backward through the buckets looking for the next non-empty hash chain
- while (_index-- > 0) {
- if ((_next = _buckets[_index]) != null) {
- return true;
- }
- }
- // found no non-empty hash chains, we're done
- return false;
- }
+ // if we're pointing to an entry, we've got more entries
+ if (_next != null) {
+ return true;
+ }
+ // search backward through the buckets looking for the next non-empty hash chain
+ while (_index-- > 0) {
+ if ((_next = _buckets[_index]) != null) {
+ return true;
+ }
+ }
+ // found no non-empty hash chains, we're done
+ return false;
+ }
- public IntIntEntry next () {
- // if we're not pointing to an entry, search for the next non-empty hash chain
+ public IntIntEntry next () {
+ // if we're not pointing to an entry, search for the next non-empty hash chain
if (hasNext()) {
_prev = _next;
_next = _next.next;
@@ -545,8 +544,8 @@ public class IntIntMap
}
}
- private int _index;
- private Record _next, _prev;
+ private int _index;
+ private Record _next, _prev;
private int _modCount;
}
diff --git a/src/java/com/samskivert/util/Log.java b/src/java/com/samskivert/util/Log.java
index 9cc84ba4..f0184c64 100644
--- a/src/java/com/samskivert/util/Log.java
+++ b/src/java/com/samskivert/util/Log.java
@@ -52,7 +52,7 @@ public final class Log
*/
public Log (String moduleName)
{
- _moduleName = moduleName;
+ _moduleName = moduleName;
// try setting our default log level for this package
try {
diff --git a/src/java/com/samskivert/util/OneLineLogFormatter.java b/src/java/com/samskivert/util/OneLineLogFormatter.java
index 3f29aea3..28a99b89 100644
--- a/src/java/com/samskivert/util/OneLineLogFormatter.java
+++ b/src/java/com/samskivert/util/OneLineLogFormatter.java
@@ -56,15 +56,15 @@ public class OneLineLogFormatter extends Formatter
@Override
public String format (LogRecord record)
{
- StringBuffer buf = new StringBuffer();
+ StringBuffer buf = new StringBuffer();
// append the timestamp
_date.setTime(record.getMillis());
- _format.format(_date, buf, _fpos);
+ _format.format(_date, buf, _fpos);
// append the log level
- buf.append(" ");
- buf.append(record.getLevel().getLocalizedName());
+ buf.append(" ");
+ buf.append(record.getLevel().getLocalizedName());
buf.append(" ");
if (_showWhere) {
@@ -90,23 +90,23 @@ public class OneLineLogFormatter extends Formatter
}
// append the message itself
- buf.append(formatMessage(record));
+ buf.append(formatMessage(record));
buf.append(FormatterUtil.LINE_SEPARATOR);
// if an exception was also provided, append that
- if (record.getThrown() != null) {
- try {
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
- record.getThrown().printStackTrace(pw);
- pw.close();
- buf.append(sw.toString());
- } catch (Exception ex) {
+ if (record.getThrown() != null) {
+ try {
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw);
+ record.getThrown().printStackTrace(pw);
+ pw.close();
+ buf.append(sw.toString());
+ } catch (Exception ex) {
buf.append("Format failure:").append(ex);
- }
- }
+ }
+ }
- return buf.toString();
+ return buf.toString();
}
/**
diff --git a/src/java/com/samskivert/util/PropertiesUtil.java b/src/java/com/samskivert/util/PropertiesUtil.java
index 0d2a9ce2..fecc3783 100644
--- a/src/java/com/samskivert/util/PropertiesUtil.java
+++ b/src/java/com/samskivert/util/PropertiesUtil.java
@@ -70,9 +70,9 @@ public class PropertiesUtil
public static Properties getSubProperties (
Properties source, String prefix)
{
- Properties dest = new Properties();
+ Properties dest = new Properties();
extractSubProperties(source, dest, prefix);
- return dest;
+ return dest;
}
/**
@@ -89,7 +89,7 @@ public class PropertiesUtil
extractSubProperties(source, defs, defaultsPrefix);
// now load up the desired properties
- Properties dest = new Properties(defs);
+ Properties dest = new Properties(defs);
extractSubProperties(source, dest, prefix);
return dest;
@@ -160,21 +160,21 @@ public class PropertiesUtil
protected static void extractSubProperties (
Properties source, Properties dest, String prefix)
{
- // extend the prefix to contain a dot
- prefix = prefix + ".";
- int preflen = prefix.length();
+ // extend the prefix to contain a dot
+ prefix = prefix + ".";
+ int preflen = prefix.length();
- // scan the source properties
- Enumeration> names = source.propertyNames();
- while (names.hasMoreElements()) {
- String name = (String)names.nextElement();
- // skip unrelated properties
- if (!name.startsWith(prefix)) {
- continue;
- }
- // insert the value into the new properties minus the prefix
- dest.put(name.substring(preflen), source.getProperty(name));
- }
+ // scan the source properties
+ Enumeration> names = source.propertyNames();
+ while (names.hasMoreElements()) {
+ String name = (String)names.nextElement();
+ // skip unrelated properties
+ if (!name.startsWith(prefix)) {
+ continue;
+ }
+ // insert the value into the new properties minus the prefix
+ dest.put(name.substring(preflen), source.getProperty(name));
+ }
}
/**
diff --git a/src/java/com/samskivert/util/Queue.java b/src/java/com/samskivert/util/Queue.java
index 05d1a108..be159b9f 100644
--- a/src/java/com/samskivert/util/Queue.java
+++ b/src/java/com/samskivert/util/Queue.java
@@ -173,17 +173,16 @@ public class Queue
*/
public synchronized T get (long maxwait)
{
- if (_count == 0) {
- try { wait(maxwait); } catch (InterruptedException e) {}
+ if (_count == 0) {
+ try { wait(maxwait); } catch (InterruptedException e) {}
- // if count's still null when we pull out, we waited
- // ourmaxwait time.
- if (_count == 0) {
- return null;
- }
- }
+ // if count's still null when we pull out, we waited ourmaxwait time.
+ if (_count == 0) {
+ return null;
+ }
+ }
- return get();
+ return get();
}
/**
diff --git a/src/java/com/samskivert/util/QuickSort.java b/src/java/com/samskivert/util/QuickSort.java
index d2dbeba7..ea22086b 100644
--- a/src/java/com/samskivert/util/QuickSort.java
+++ b/src/java/com/samskivert/util/QuickSort.java
@@ -33,7 +33,7 @@ public class QuickSort
*/
public static void sort (T[] a, Comparator super T> comp)
{
- sort(a, 0, a.length - 1, comp);
+ sort(a, 0, a.length - 1, comp);
}
/**
@@ -41,7 +41,7 @@ public class QuickSort
*/
public static > void sort (T[] a)
{
- sort(a, 0, a.length - 1);
+ sort(a, 0, a.length - 1);
}
/**
@@ -49,7 +49,7 @@ public class QuickSort
*/
public static void rsort (T[] a, Comparator super T> comp)
{
- rsort(a, 0, a.length - 1, comp);
+ rsort(a, 0, a.length - 1, comp);
}
/**
@@ -72,7 +72,7 @@ public class QuickSort
public static void sort (T[] a, int lo0, int hi0, Comparator super T> comp)
{
// bail out if we're already done
- if (hi0 <= lo0) {
+ if (hi0 <= lo0) {
return;
}
@@ -136,7 +136,7 @@ public class QuickSort
public static void rsort (T[] a, int lo0, int hi0, Comparator super T> comp)
{
// bail out if we're already done
- if (hi0 <= lo0) {
+ if (hi0 <= lo0) {
return;
}
@@ -199,7 +199,7 @@ public class QuickSort
public static > void sort (T[] a, int lo0, int hi0)
{
// bail out if we're already done
- if (hi0 <= lo0) {
+ if (hi0 <= lo0) {
return;
}
@@ -262,7 +262,7 @@ public class QuickSort
public static > void rsort (T[] a, int lo0, int hi0)
{
// bail out if we're already done
- if (hi0 <= lo0) {
+ if (hi0 <= lo0) {
return;
}
@@ -381,7 +381,7 @@ public class QuickSort
public static void sort (List a, int lo0, int hi0, Comparator comp)
{
// bail out if we're already done
- if (hi0 <= lo0) {
+ if (hi0 <= lo0) {
return;
}
diff --git a/src/java/com/samskivert/util/TerseLogFormatter.java b/src/java/com/samskivert/util/TerseLogFormatter.java
index 1d15f916..9f0e61e2 100644
--- a/src/java/com/samskivert/util/TerseLogFormatter.java
+++ b/src/java/com/samskivert/util/TerseLogFormatter.java
@@ -34,26 +34,26 @@ public class TerseLogFormatter extends Formatter
@Override
public String format (LogRecord record)
{
- StringBuffer buf = new StringBuffer();
+ StringBuffer buf = new StringBuffer();
// append the message itself
- buf.append(formatMessage(record));
+ buf.append(formatMessage(record));
buf.append(FormatterUtil.LINE_SEPARATOR);
// if an exception was also provided, append that
- if (record.getThrown() != null) {
- try {
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
- record.getThrown().printStackTrace(pw);
- pw.close();
- buf.append(sw.toString());
- } catch (Exception ex) {
+ if (record.getThrown() != null) {
+ try {
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw);
+ record.getThrown().printStackTrace(pw);
+ pw.close();
+ buf.append(sw.toString());
+ } catch (Exception ex) {
buf.append("Format failure:").append(ex);
- }
- }
+ }
+ }
- return buf.toString();
+ return buf.toString();
}
/**
diff --git a/src/java/com/samskivert/velocity/DummyLogic.java b/src/java/com/samskivert/velocity/DummyLogic.java
index 4d7f410c..6327bfb5 100644
--- a/src/java/com/samskivert/velocity/DummyLogic.java
+++ b/src/java/com/samskivert/velocity/DummyLogic.java
@@ -30,6 +30,6 @@ public class DummyLogic implements Logic
public void invoke (Application app, InvocationContext context)
throws Exception
{
- // we're such a dummy that we do absolutely nothing.
+ // we're such a dummy that we do absolutely nothing.
}
}
diff --git a/src/java/com/samskivert/xml/CallMethodSpecialRule.java b/src/java/com/samskivert/xml/CallMethodSpecialRule.java
index 52ade62e..f56c20af 100644
--- a/src/java/com/samskivert/xml/CallMethodSpecialRule.java
+++ b/src/java/com/samskivert/xml/CallMethodSpecialRule.java
@@ -41,12 +41,12 @@ public abstract class CallMethodSpecialRule extends Rule
public void end (String namespace, String name)
throws Exception
{
- Object top = digester.peek();
+ Object top = digester.peek();
- if (digester.getLogger().isDebugEnabled()) {
- digester.getLogger().debug(
- "CallSpecial " + StringUtil.shortClassName(this) +
- ".parseAndSet(" + StringUtil.shortClassName(top) + ")");
+ if (digester.getLogger().isDebugEnabled()) {
+ digester.getLogger().debug(
+ "CallSpecial " + StringUtil.shortClassName(this) +
+ ".parseAndSet(" + StringUtil.shortClassName(top) + ")");
}
parseAndSet(_bodyText, top);
diff --git a/src/java/com/samskivert/xml/SetNextFieldRule.java b/src/java/com/samskivert/xml/SetNextFieldRule.java
index c4dad1d8..54660943 100644
--- a/src/java/com/samskivert/xml/SetNextFieldRule.java
+++ b/src/java/com/samskivert/xml/SetNextFieldRule.java
@@ -43,12 +43,12 @@ public class SetNextFieldRule extends Rule
public void end (String namespace, String name)
throws Exception
{
- // identify the objects to be used
- Object child = digester.peek(0);
- Object parent = digester.peek(1);
- Class> pclass = parent.getClass();
+ // identify the objects to be used
+ Object child = digester.peek(0);
+ Object parent = digester.peek(1);
+ Class> pclass = parent.getClass();
- if (digester.getLogger().isDebugEnabled()) {
+ if (digester.getLogger().isDebugEnabled()) {
digester.getLogger().debug("Set " + pclass.getName() + "." +
_fieldName + " = " + child);
}
diff --git a/src/java/com/samskivert/xml/SetPropertyFieldsRule.java b/src/java/com/samskivert/xml/SetPropertyFieldsRule.java
index debf6b1b..e2b97e11 100644
--- a/src/java/com/samskivert/xml/SetPropertyFieldsRule.java
+++ b/src/java/com/samskivert/xml/SetPropertyFieldsRule.java
@@ -90,7 +90,7 @@ public class SetPropertyFieldsRule extends Rule
// iterate over the attributes, setting public fields where applicable
for (int i = 0; i < attrs.getLength(); i++) {
- String lname = attrs.getLocalName(i);
+ String lname = attrs.getLocalName(i);
if (StringUtil.isBlank(lname)) {
lname = attrs.getQName(i);
}
@@ -108,7 +108,7 @@ public class SetPropertyFieldsRule extends Rule
}
// convert the value into the appropriate object type
- String valstr = attrs.getValue(i);
+ String valstr = attrs.getValue(i);
FieldParser parser = null;
Object value;
diff --git a/src/java/com/samskivert/xml/SimpleParser.java b/src/java/com/samskivert/xml/SimpleParser.java
index a2c82a13..d4333cbb 100644
--- a/src/java/com/samskivert/xml/SimpleParser.java
+++ b/src/java/com/samskivert/xml/SimpleParser.java
@@ -38,13 +38,13 @@ public class SimpleParser extends DefaultHandler
@Override
public void characters (char ch[], int start, int length)
{
- _chars.append(ch, start, length);
+ _chars.append(ch, start, length);
}
@Override
public void endElement (String uri, String localName, String qName)
{
- finishElement(uri, localName, qName, _chars.toString().trim());
+ finishElement(uri, localName, qName, _chars.toString().trim());
_chars = new StringBuilder();
}
@@ -74,17 +74,17 @@ public class SimpleParser extends DefaultHandler
public void parseStream (InputStream stream)
throws IOException
{
- try {
+ try {
// read the XML input stream and construct the scene object
_chars = new StringBuilder();
- XMLUtil.parse(this, stream);
+ XMLUtil.parse(this, stream);
} catch (ParserConfigurationException pce) {
- throw (IOException) new IOException().initCause(pce);
+ throw (IOException) new IOException().initCause(pce);
- } catch (SAXException saxe) {
- throw (IOException) new IOException().initCause(saxe);
- }
+ } catch (SAXException saxe) {
+ throw (IOException) new IOException().initCause(saxe);
+ }
}
/**
diff --git a/src/java/com/samskivert/xml/XMLUtil.java b/src/java/com/samskivert/xml/XMLUtil.java
index 036ba932..22257cfe 100644
--- a/src/java/com/samskivert/xml/XMLUtil.java
+++ b/src/java/com/samskivert/xml/XMLUtil.java
@@ -44,21 +44,21 @@ public class XMLUtil
* @param in the input stream containing the XML to be parsed
*/
public static void parse (DefaultHandler handler, InputStream in)
- throws IOException, ParserConfigurationException, SAXException
+ throws IOException, ParserConfigurationException, SAXException
{
- XMLReader xr = _pfactory.newSAXParser().getXMLReader();
+ XMLReader xr = _pfactory.newSAXParser().getXMLReader();
- xr.setContentHandler(handler);
- xr.setErrorHandler(handler);
+ xr.setContentHandler(handler);
+ xr.setErrorHandler(handler);
- xr.parse(new InputSource(in));
+ xr.parse(new InputSource(in));
}
/** The factory from whence we obtain XMLReader objects */
protected static SAXParserFactory _pfactory;
static {
- _pfactory = SAXParserFactory.newInstance();
- _pfactory.setValidating(false);
+ _pfactory = SAXParserFactory.newInstance();
+ _pfactory.setValidating(false);
}
}