From Dave: a bunch of @Override annotating and some other cleanup.

git-svn-id: https://samskivert.googlecode.com/svn/trunk@2356 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
mdb
2008-08-06 12:59:06 +00:00
parent 3a283a16e1
commit ca764911c8
116 changed files with 529 additions and 437 deletions
@@ -70,133 +70,133 @@ public abstract class ExtensiblePrintStream extends PrintStream
*/ */
public abstract void handleNewLine (); public abstract void handleNewLine ();
// documentation inherited @Override
public void print (boolean b) public void print (boolean b)
{ {
super.print(b); super.print(b);
handlePrinted(b ? "true" : "false"); handlePrinted(b ? "true" : "false");
} }
// documentation inherited @Override
public void print (char c) public void print (char c)
{ {
super.print(c); super.print(c);
handlePrinted(String.valueOf(c)); handlePrinted(String.valueOf(c));
} }
// documentation inherited @Override
public void print (int i) public void print (int i)
{ {
super.print(i); super.print(i);
handlePrinted(String.valueOf(i)); handlePrinted(String.valueOf(i));
} }
// documentation inherited @Override
public void print (long l) public void print (long l)
{ {
super.print(l); super.print(l);
handlePrinted(String.valueOf(l)); handlePrinted(String.valueOf(l));
} }
// documentation inherited @Override
public void print (float f) public void print (float f)
{ {
super.print(f); super.print(f);
handlePrinted(String.valueOf(f)); handlePrinted(String.valueOf(f));
} }
// documentation inherited @Override
public void print (double d) public void print (double d)
{ {
super.print(d); super.print(d);
handlePrinted(String.valueOf(d)); handlePrinted(String.valueOf(d));
} }
// documentation inherited @Override
public void print (char[] s) public void print (char[] s)
{ {
super.print(s); super.print(s);
handlePrinted(String.valueOf(s)); handlePrinted(String.valueOf(s));
} }
// documentation inherited @Override
public void print (String s) public void print (String s)
{ {
super.print(s); super.print(s);
handlePrinted((s == null) ? "null" : s); handlePrinted((s == null) ? "null" : s);
} }
// documentation inherited @Override
public void print (Object obj) public void print (Object obj)
{ {
super.print(obj); super.print(obj);
handlePrinted(String.valueOf(obj)); handlePrinted(String.valueOf(obj));
} }
// documentation inherited @Override
public void println () public void println ()
{ {
super.println(); super.println();
handleNewLine(); handleNewLine();
} }
// documentation inherited @Override
public void println (boolean x) public void println (boolean x)
{ {
super.println(x); super.println(x);
handleNewLine(); handleNewLine();
} }
// documentation inherited @Override
public void println (char x) public void println (char x)
{ {
super.println(x); super.println(x);
handleNewLine(); handleNewLine();
} }
// documentation inherited @Override
public void println (int x) public void println (int x)
{ {
super.println(x); super.println(x);
handleNewLine(); handleNewLine();
} }
// documentation inherited @Override
public void println (long x) public void println (long x)
{ {
super.println(x); super.println(x);
handleNewLine(); handleNewLine();
} }
// documentation inherited @Override
public void println (float x) public void println (float x)
{ {
super.println(x); super.println(x);
handleNewLine(); handleNewLine();
} }
// documentation inherited @Override
public void println (double x) public void println (double x)
{ {
super.println(x); super.println(x);
handleNewLine(); handleNewLine();
} }
// documentation inherited @Override
public void println (char[] x) public void println (char[] x)
{ {
super.println(x); super.println(x);
handleNewLine(); handleNewLine();
} }
// documentation inherited @Override
public void println (String x) public void println (String x)
{ {
super.println(x); super.println(x);
handleNewLine(); handleNewLine();
} }
// documentation inherited @Override
public void println (Object x) public void println (Object x)
{ {
super.println(x); super.println(x);
@@ -38,7 +38,7 @@ public abstract class WriteOnlyUnit extends Invoker.Unit
super(name); super(name);
} }
// from abstract Invoker.Unit @Override // from abstract Invoker.Unit
public boolean invoke () public boolean invoke ()
{ {
try { try {
@@ -42,7 +42,7 @@ public interface CacheInvalidator
public void invalidate (PersistenceContext ctx) { public void invalidate (PersistenceContext ctx) {
ctx.cacheTraverse(_cacheId, new PersistenceContext.CacheEvictionFilter<T>() { ctx.cacheTraverse(_cacheId, new PersistenceContext.CacheEvictionFilter<T>() {
protected boolean testForEviction (Serializable key, T record) { @Override protected boolean testForEviction (Serializable key, T record) {
return TraverseWithFilter.this.testForEviction(key, record); return TraverseWithFilter.this.testForEviction(key, record);
} }
}); });
@@ -565,7 +565,7 @@ public class DepotMarshaller<T extends PersistentRecord>
// check to see if our schema version table exists, create it if not // check to see if our schema version table exists, create it if not
ctx.invoke(new Modifier() { ctx.invoke(new Modifier() {
public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException { @Override public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
liaison.createTableIfMissing( liaison.createTableIfMissing(
conn, SCHEMA_VERSION_TABLE, conn, SCHEMA_VERSION_TABLE,
new String[] { "persistentClass", "version" }, new String[] { "persistentClass", "version" },
@@ -592,7 +592,7 @@ public class DepotMarshaller<T extends PersistentRecord>
} }
final Iterable<Index> indexen = _indexes.values(); final Iterable<Index> indexen = _indexes.values();
ctx.invoke(new Modifier() { ctx.invoke(new Modifier() {
public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException { @Override public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
// create the table // create the table
String[] primaryKeyColumns = null; String[] primaryKeyColumns = null;
if (_pkColumns != null) { if (_pkColumns != null) {
@@ -640,7 +640,7 @@ public class DepotMarshaller<T extends PersistentRecord>
// make sure the versions match // make sure the versions match
int currentVersion = ctx.invoke(new Modifier() { int currentVersion = ctx.invoke(new Modifier() {
public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException { @Override public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
String query = String query =
" select " + liaison.columnSQL("version") + " select " + liaison.columnSQL("version") +
" from " + liaison.tableSQL(SCHEMA_VERSION_TABLE) + " from " + liaison.tableSQL(SCHEMA_VERSION_TABLE) +
@@ -693,7 +693,7 @@ public class DepotMarshaller<T extends PersistentRecord>
final ColumnDefinition coldef = fmarsh.getColumnDefinition(); final ColumnDefinition coldef = fmarsh.getColumnDefinition();
log.info("Adding column to " + getTableName() + ": " + fmarsh.getColumnName()); log.info("Adding column to " + getTableName() + ": " + fmarsh.getColumnName());
ctx.invoke(new Modifier.Simple() { ctx.invoke(new Modifier.Simple() {
protected String createQuery (DatabaseLiaison liaison) { @Override protected String createQuery (DatabaseLiaison liaison) {
return "alter table " + liaison.tableSQL(getTableName()) + return "alter table " + liaison.tableSQL(getTableName()) +
" add column " + liaison.columnSQL(fmarsh.getColumnName()) + " " + " add column " + liaison.columnSQL(fmarsh.getColumnName()) + " " +
liaison.expandDefinition(coldef); liaison.expandDefinition(coldef);
@@ -709,7 +709,7 @@ public class DepotMarshaller<T extends PersistentRecord>
coldef.getType().equalsIgnoreCase("datetime"))) { coldef.getType().equalsIgnoreCase("datetime"))) {
log.info("Assigning current time to " + fmarsh.getColumnName() + "."); log.info("Assigning current time to " + fmarsh.getColumnName() + ".");
ctx.invoke(new Modifier.Simple() { ctx.invoke(new Modifier.Simple() {
protected String createQuery (DatabaseLiaison liaison) { @Override protected String createQuery (DatabaseLiaison liaison) {
// TODO: is NOW() standard SQL? // TODO: is NOW() standard SQL?
return "update " + liaison.tableSQL(getTableName()) + return "update " + liaison.tableSQL(getTableName()) +
" set " + liaison.columnSQL(fmarsh.getColumnName()) + " = NOW()"; " set " + liaison.columnSQL(fmarsh.getColumnName()) + " = NOW()";
@@ -722,7 +722,7 @@ public class DepotMarshaller<T extends PersistentRecord>
if (hasPrimaryKey() && metaData.pkName == null) { if (hasPrimaryKey() && metaData.pkName == null) {
log.info("Adding primary key."); log.info("Adding primary key.");
ctx.invoke(new Modifier() { ctx.invoke(new Modifier() {
public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException { @Override public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
liaison.addPrimaryKey( liaison.addPrimaryKey(
conn, getTableName(), fieldsToColumns(getPrimaryKeyFields())); conn, getTableName(), fieldsToColumns(getPrimaryKeyFields()));
return 0; return 0;
@@ -733,7 +733,7 @@ public class DepotMarshaller<T extends PersistentRecord>
final String pkName = metaData.pkName; final String pkName = metaData.pkName;
log.info("Dropping primary key: " + pkName); log.info("Dropping primary key: " + pkName);
ctx.invoke(new Modifier() { ctx.invoke(new Modifier() {
public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException { @Override public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
liaison.dropPrimaryKey(conn, getTableName(), pkName); liaison.dropPrimaryKey(conn, getTableName(), pkName);
return 0; return 0;
} }
@@ -750,7 +750,7 @@ public class DepotMarshaller<T extends PersistentRecord>
} }
// but this is a new, named index, so we create it // but this is a new, named index, so we create it
ctx.invoke(new Modifier() { ctx.invoke(new Modifier() {
public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException { @Override public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
liaison.addIndexToTable( liaison.addIndexToTable(
conn, getTableName(), fieldsToColumns(index.fields()), conn, getTableName(), fieldsToColumns(index.fields()),
ixName, index.unique()); ixName, index.unique());
@@ -785,7 +785,7 @@ public class DepotMarshaller<T extends PersistentRecord>
final String[] colArr = colSet.toArray(new String[colSet.size()]); final String[] colArr = colSet.toArray(new String[colSet.size()]);
final String fName = indexName; final String fName = indexName;
ctx.invoke(new Modifier() { ctx.invoke(new Modifier() {
public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException { @Override public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
liaison.addIndexToTable(conn, getTableName(), colArr, fName, true); liaison.addIndexToTable(conn, getTableName(), colArr, fName, true);
return 0; return 0;
} }
@@ -806,7 +806,7 @@ public class DepotMarshaller<T extends PersistentRecord>
// but not this one, so let's create it // but not this one, so let's create it
ctx.invoke(new Modifier() { ctx.invoke(new Modifier() {
public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException { @Override public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
builder.addFullTextSearch(conn, DepotMarshaller.this, recordFts); builder.addFullTextSearch(conn, DepotMarshaller.this, recordFts);
return 0; return 0;
} }
@@ -832,7 +832,7 @@ public class DepotMarshaller<T extends PersistentRecord>
// last of all (re-)initialize our value generators, since one might've been added // last of all (re-)initialize our value generators, since one might've been added
if (_valueGenerators.size() > 0) { if (_valueGenerators.size() > 0) {
ctx.invoke(new Modifier() { ctx.invoke(new Modifier() {
public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException { @Override public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
for (ValueGenerator vg : _valueGenerators.values()) { for (ValueGenerator vg : _valueGenerators.values()) {
vg.init(conn, liaison); vg.init(conn, liaison);
} }
@@ -843,7 +843,7 @@ public class DepotMarshaller<T extends PersistentRecord>
// record our new version in the database // record our new version in the database
ctx.invoke(new Modifier() { ctx.invoke(new Modifier() {
public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException { @Override public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
updateVersion(conn, liaison, _schemaVersion); updateVersion(conn, liaison, _schemaVersion);
return 0; return 0;
} }
@@ -916,7 +916,7 @@ public class DepotMarshaller<T extends PersistentRecord>
throws PersistenceException throws PersistenceException
{ {
return ctx.invoke(new Query.TrivialQuery<TableMetaData>() { return ctx.invoke(new Query.TrivialQuery<TableMetaData>() {
public TableMetaData invoke (Connection conn, DatabaseLiaison dl) @Override public TableMetaData invoke (Connection conn, DatabaseLiaison dl)
throws SQLException { throws SQLException {
return new TableMetaData(conn.getMetaData(), tableName); return new TableMetaData(conn.getMetaData(), tableName);
} }
@@ -187,7 +187,7 @@ public abstract class DepotRepository
// key will be null if record was supplied without a primary key // key will be null if record was supplied without a primary key
return _ctx.invoke(new CachingModifier<T>(record, key, key) { return _ctx.invoke(new CachingModifier<T>(record, key, key) {
public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException { @Override public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
// set any auto-generated column values // set any auto-generated column values
Set<String> identityFields = Set<String> identityFields =
marsh.generateFieldValues(conn, liaison, _result, false); marsh.generateFieldValues(conn, liaison, _result, false);
@@ -241,7 +241,7 @@ public abstract class DepotRepository
builder.newQuery(update); builder.newQuery(update);
return _ctx.invoke(new CachingModifier<T>(record, key, key) { return _ctx.invoke(new CachingModifier<T>(record, key, key) {
public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException { @Override public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
PreparedStatement stmt = builder.prepare(conn); PreparedStatement stmt = builder.prepare(conn);
try { try {
return stmt.executeUpdate(); return stmt.executeUpdate();
@@ -282,7 +282,7 @@ public abstract class DepotRepository
builder.newQuery(update); builder.newQuery(update);
return _ctx.invoke(new CachingModifier<T>(record, key, key) { return _ctx.invoke(new CachingModifier<T>(record, key, key) {
public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException { @Override public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
PreparedStatement stmt = builder.prepare(conn); PreparedStatement stmt = builder.prepare(conn);
// clear out _result so that we don't rewrite this partial record to the cache // clear out _result so that we don't rewrite this partial record to the cache
_result = null; _result = null;
@@ -424,7 +424,7 @@ public abstract class DepotRepository
builder.newQuery(update); builder.newQuery(update);
return _ctx.invoke(new Modifier(invalidator) { return _ctx.invoke(new Modifier(invalidator) {
public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException { @Override public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
PreparedStatement stmt = builder.prepare(conn); PreparedStatement stmt = builder.prepare(conn);
try { try {
return stmt.executeUpdate(); return stmt.executeUpdate();
@@ -556,7 +556,7 @@ public abstract class DepotRepository
builder.newQuery(update); builder.newQuery(update);
return _ctx.invoke(new Modifier(invalidator) { return _ctx.invoke(new Modifier(invalidator) {
public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException { @Override public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
PreparedStatement stmt = builder.prepare(conn); PreparedStatement stmt = builder.prepare(conn);
try { try {
return stmt.executeUpdate(); return stmt.executeUpdate();
@@ -593,7 +593,7 @@ public abstract class DepotRepository
final boolean[] created = new boolean[1]; final boolean[] created = new boolean[1];
_ctx.invoke(new CachingModifier<T>(record, key, key) { _ctx.invoke(new CachingModifier<T>(record, key, key) {
public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException { @Override public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
PreparedStatement stmt = null; PreparedStatement stmt = null;
try { try {
if (_key != null) { if (_key != null) {
@@ -701,7 +701,7 @@ public abstract class DepotRepository
builder.newQuery(delete); builder.newQuery(delete);
return _ctx.invoke(new Modifier(invalidator) { return _ctx.invoke(new Modifier(invalidator) {
public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException { @Override public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
PreparedStatement stmt = builder.prepare(conn); PreparedStatement stmt = builder.prepare(conn);
try { try {
return stmt.executeUpdate(); return stmt.executeUpdate();
@@ -79,7 +79,7 @@ public class EHCacheAdapter
public T getValue () { public T getValue () {
return value; return value;
} }
public String toString () { @Override public String toString () {
return String.valueOf(value); return String.valueOf(value);
} }
}; };
@@ -147,17 +147,17 @@ public class EHCacheAdapter
/** A class to represent an explicitly Serializable concept of null for EHCache. */ /** A class to represent an explicitly Serializable concept of null for EHCache. */
protected static class NullValue implements Serializable protected static class NullValue implements Serializable
{ {
public String toString () @Override public String toString ()
{ {
return "<EHCache Null>"; return "<EHCache Null>";
} }
public boolean equals (Object other) @Override public boolean equals (Object other)
{ {
return other != null && other.getClass().equals(NullValue.class); return other != null && other.getClass().equals(NullValue.class);
} }
public int hashCode () @Override public int hashCode ()
{ {
return 1; return 1;
} }
@@ -47,7 +47,7 @@ public abstract class EntityMigration extends Modifier
_columnName = columnName; _columnName = columnName;
} }
public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException { @Override public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
if (!liaison.tableContainsColumn(conn, _tableName, _columnName)) { if (!liaison.tableContainsColumn(conn, _tableName, _columnName)) {
// we'll accept this inconsistency // we'll accept this inconsistency
log.warning(_tableName + "." + _columnName + " already dropped."); log.warning(_tableName + "." + _columnName + " already dropped.");
@@ -72,7 +72,7 @@ public abstract class EntityMigration extends Modifier
_newColumnName = newColumnName; _newColumnName = newColumnName;
} }
public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException { @Override public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
if (!liaison.tableContainsColumn(conn, _tableName, _oldColumnName)) { if (!liaison.tableContainsColumn(conn, _tableName, _oldColumnName)) {
if (liaison.tableContainsColumn(conn, _tableName, _newColumnName)) { if (liaison.tableContainsColumn(conn, _tableName, _newColumnName)) {
// we'll accept this inconsistency // we'll accept this inconsistency
@@ -97,11 +97,11 @@ public abstract class EntityMigration extends Modifier
conn, _tableName, _oldColumnName, _newColumnName, _newColumnDef) ? 1 : 0; conn, _tableName, _oldColumnName, _newColumnName, _newColumnDef) ? 1 : 0;
} }
public boolean runBeforeDefault () { @Override public boolean runBeforeDefault () {
return true; return true;
} }
protected void init (String tableName, Map<String,FieldMarshaller<?>> marshallers) { @Override protected void init (String tableName, Map<String,FieldMarshaller<?>> marshallers) {
super.init(tableName, marshallers); super.init(tableName, marshallers);
_newColumnDef = marshallers.get(_newColumnName).getColumnDefinition(); _newColumnDef = marshallers.get(_newColumnName).getColumnDefinition();
} }
@@ -122,18 +122,18 @@ public abstract class EntityMigration extends Modifier
_fieldName = fieldName; _fieldName = fieldName;
} }
public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException { @Override public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
log.info("Updating type of '" + _fieldName + "' in " + _tableName); log.info("Updating type of '" + _fieldName + "' in " + _tableName);
return liaison.changeColumn(conn, _tableName, _fieldName, _newColumnDef.getType(), return liaison.changeColumn(conn, _tableName, _fieldName, _newColumnDef.getType(),
_newColumnDef.isNullable(), _newColumnDef.isUnique(), _newColumnDef.isNullable(), _newColumnDef.isUnique(),
_newColumnDef.getDefaultValue()) ? 1 : 0; _newColumnDef.getDefaultValue()) ? 1 : 0;
} }
public boolean runBeforeDefault () { @Override public boolean runBeforeDefault () {
return false; return false;
} }
protected void init (String tableName, Map<String,FieldMarshaller<?>> marshallers) { @Override protected void init (String tableName, Map<String,FieldMarshaller<?>> marshallers) {
super.init(tableName, marshallers); super.init(tableName, marshallers);
_columnName = marshallers.get(_fieldName).getColumnName(); _columnName = marshallers.get(_fieldName).getColumnName();
_newColumnDef = marshallers.get(_fieldName).getColumnDefinition(); _newColumnDef = marshallers.get(_fieldName).getColumnDefinition();
@@ -227,190 +227,190 @@ public abstract class FieldMarshaller<T>
} }
protected static class BooleanMarshaller extends FieldMarshaller<Boolean> { protected static class BooleanMarshaller extends FieldMarshaller<Boolean> {
public Boolean getFromObject (Object po) @Override public Boolean getFromObject (Object po)
throws IllegalArgumentException, IllegalAccessException { throws IllegalArgumentException, IllegalAccessException {
return _field.getBoolean(po); return _field.getBoolean(po);
} }
public Boolean getFromSet (ResultSet rs) @Override public Boolean getFromSet (ResultSet rs)
throws SQLException { throws SQLException {
return rs.getBoolean(getColumnName()); return rs.getBoolean(getColumnName());
} }
public void writeToObject (Object po, Boolean value) @Override public void writeToObject (Object po, Boolean value)
throws IllegalArgumentException, IllegalAccessException { throws IllegalArgumentException, IllegalAccessException {
_field.setBoolean(po, value); _field.setBoolean(po, value);
} }
public void writeToStatement (PreparedStatement ps, int column, Boolean value) @Override public void writeToStatement (PreparedStatement ps, int column, Boolean value)
throws SQLException { throws SQLException {
ps.setBoolean(column, value); ps.setBoolean(column, value);
} }
} }
protected static class ByteMarshaller extends FieldMarshaller<Byte> { protected static class ByteMarshaller extends FieldMarshaller<Byte> {
public Byte getFromObject (Object po) @Override public Byte getFromObject (Object po)
throws IllegalArgumentException, IllegalAccessException { throws IllegalArgumentException, IllegalAccessException {
return _field.getByte(po); return _field.getByte(po);
} }
public Byte getFromSet (ResultSet rs) @Override public Byte getFromSet (ResultSet rs)
throws SQLException { throws SQLException {
return rs.getByte(getColumnName()); return rs.getByte(getColumnName());
} }
public void writeToObject (Object po, Byte value) @Override public void writeToObject (Object po, Byte value)
throws IllegalArgumentException, IllegalAccessException { throws IllegalArgumentException, IllegalAccessException {
_field.setByte(po, value); _field.setByte(po, value);
} }
public void writeToStatement (PreparedStatement ps, int column, Byte value) @Override public void writeToStatement (PreparedStatement ps, int column, Byte value)
throws SQLException { throws SQLException {
ps.setByte(column, value); ps.setByte(column, value);
} }
} }
protected static class ShortMarshaller extends FieldMarshaller<Short> { protected static class ShortMarshaller extends FieldMarshaller<Short> {
public Short getFromObject (Object po) @Override public Short getFromObject (Object po)
throws IllegalArgumentException, IllegalAccessException { throws IllegalArgumentException, IllegalAccessException {
return _field.getShort(po); return _field.getShort(po);
} }
public Short getFromSet (ResultSet rs) @Override public Short getFromSet (ResultSet rs)
throws SQLException { throws SQLException {
return rs.getShort(getColumnName()); return rs.getShort(getColumnName());
} }
public void writeToObject (Object po, Short value) @Override public void writeToObject (Object po, Short value)
throws IllegalArgumentException, IllegalAccessException { throws IllegalArgumentException, IllegalAccessException {
_field.setShort(po, value); _field.setShort(po, value);
} }
public void writeToStatement (PreparedStatement ps, int column, Short value) @Override public void writeToStatement (PreparedStatement ps, int column, Short value)
throws SQLException { throws SQLException {
ps.setShort(column, value); ps.setShort(column, value);
} }
} }
protected static class IntMarshaller extends FieldMarshaller<Integer> { protected static class IntMarshaller extends FieldMarshaller<Integer> {
public Integer getFromObject (Object po) @Override public Integer getFromObject (Object po)
throws IllegalArgumentException, IllegalAccessException { throws IllegalArgumentException, IllegalAccessException {
return _field.getInt(po); return _field.getInt(po);
} }
public Integer getFromSet (ResultSet rs) @Override public Integer getFromSet (ResultSet rs)
throws SQLException { throws SQLException {
return rs.getInt(getColumnName()); return rs.getInt(getColumnName());
} }
public void writeToObject (Object po, Integer value) @Override public void writeToObject (Object po, Integer value)
throws IllegalArgumentException, IllegalAccessException { throws IllegalArgumentException, IllegalAccessException {
_field.setInt(po, value); _field.setInt(po, value);
} }
public void writeToStatement (PreparedStatement ps, int column, Integer value) @Override public void writeToStatement (PreparedStatement ps, int column, Integer value)
throws SQLException { throws SQLException {
ps.setInt(column, value); ps.setInt(column, value);
} }
} }
protected static class LongMarshaller extends FieldMarshaller<Long> { protected static class LongMarshaller extends FieldMarshaller<Long> {
public Long getFromObject (Object po) @Override public Long getFromObject (Object po)
throws IllegalArgumentException, IllegalAccessException { throws IllegalArgumentException, IllegalAccessException {
return _field.getLong(po); return _field.getLong(po);
} }
public Long getFromSet (ResultSet rs) @Override public Long getFromSet (ResultSet rs)
throws SQLException { throws SQLException {
return rs.getLong(getColumnName()); return rs.getLong(getColumnName());
} }
public void writeToObject (Object po, Long value) @Override public void writeToObject (Object po, Long value)
throws IllegalArgumentException, IllegalAccessException { throws IllegalArgumentException, IllegalAccessException {
_field.setLong(po, value); _field.setLong(po, value);
} }
public void writeToStatement (PreparedStatement ps, int column, Long value) @Override public void writeToStatement (PreparedStatement ps, int column, Long value)
throws SQLException { throws SQLException {
ps.setLong(column, value); ps.setLong(column, value);
} }
} }
protected static class FloatMarshaller extends FieldMarshaller<Float> { protected static class FloatMarshaller extends FieldMarshaller<Float> {
public Float getFromObject (Object po) @Override public Float getFromObject (Object po)
throws IllegalArgumentException, IllegalAccessException { throws IllegalArgumentException, IllegalAccessException {
return _field.getFloat(po); return _field.getFloat(po);
} }
public Float getFromSet (ResultSet rs) @Override public Float getFromSet (ResultSet rs)
throws SQLException { throws SQLException {
return rs.getFloat(getColumnName()); return rs.getFloat(getColumnName());
} }
public void writeToObject (Object po, Float value) @Override public void writeToObject (Object po, Float value)
throws IllegalArgumentException, IllegalAccessException { throws IllegalArgumentException, IllegalAccessException {
_field.setFloat(po, value); _field.setFloat(po, value);
} }
public void writeToStatement (PreparedStatement ps, int column, Float value) @Override public void writeToStatement (PreparedStatement ps, int column, Float value)
throws SQLException { throws SQLException {
ps.setFloat(column, value); ps.setFloat(column, value);
} }
} }
protected static class DoubleMarshaller extends FieldMarshaller<Double> { protected static class DoubleMarshaller extends FieldMarshaller<Double> {
public Double getFromObject (Object po) @Override public Double getFromObject (Object po)
throws IllegalArgumentException, IllegalAccessException { throws IllegalArgumentException, IllegalAccessException {
return _field.getDouble(po); return _field.getDouble(po);
} }
public Double getFromSet (ResultSet rs) @Override public Double getFromSet (ResultSet rs)
throws SQLException { throws SQLException {
return rs.getDouble(getColumnName()); return rs.getDouble(getColumnName());
} }
public void writeToObject (Object po, Double value) @Override public void writeToObject (Object po, Double value)
throws IllegalArgumentException, IllegalAccessException { throws IllegalArgumentException, IllegalAccessException {
_field.setDouble(po, value); _field.setDouble(po, value);
} }
public void writeToStatement (PreparedStatement ps, int column, Double value) @Override public void writeToStatement (PreparedStatement ps, int column, Double value)
throws SQLException { throws SQLException {
ps.setDouble(column, value); ps.setDouble(column, value);
} }
} }
protected static class ObjectMarshaller extends FieldMarshaller<Object> { protected static class ObjectMarshaller extends FieldMarshaller<Object> {
public Object getFromObject (Object po) @Override public Object getFromObject (Object po)
throws IllegalArgumentException, IllegalAccessException { throws IllegalArgumentException, IllegalAccessException {
return _field.get(po); return _field.get(po);
} }
public Object getFromSet (ResultSet rs) @Override public Object getFromSet (ResultSet rs)
throws SQLException { throws SQLException {
return rs.getObject(getColumnName()); return rs.getObject(getColumnName());
} }
public void writeToObject (Object po, Object value) @Override public void writeToObject (Object po, Object value)
throws IllegalArgumentException, IllegalAccessException { throws IllegalArgumentException, IllegalAccessException {
_field.set(po, value); _field.set(po, value);
} }
public void writeToStatement (PreparedStatement ps, int column, Object value) @Override public void writeToStatement (PreparedStatement ps, int column, Object value)
throws SQLException { throws SQLException {
ps.setObject(column, value); ps.setObject(column, value);
} }
} }
protected static class ByteArrayMarshaller extends FieldMarshaller<byte[]> { protected static class ByteArrayMarshaller extends FieldMarshaller<byte[]> {
public byte[] getFromObject (Object po) @Override public byte[] getFromObject (Object po)
throws IllegalArgumentException, IllegalAccessException { throws IllegalArgumentException, IllegalAccessException {
return (byte[]) _field.get(po); return (byte[]) _field.get(po);
} }
public byte[] getFromSet (ResultSet rs) @Override public byte[] getFromSet (ResultSet rs)
throws SQLException { throws SQLException {
return rs.getBytes(getColumnName()); return rs.getBytes(getColumnName());
} }
public void writeToObject (Object po, byte[] value) @Override public void writeToObject (Object po, byte[] value)
throws IllegalArgumentException, IllegalAccessException { throws IllegalArgumentException, IllegalAccessException {
_field.set(po, value); _field.set(po, value);
} }
public void writeToStatement (PreparedStatement ps, int column, byte[] value) @Override public void writeToStatement (PreparedStatement ps, int column, byte[] value)
throws SQLException { throws SQLException {
ps.setBytes(column, value); ps.setBytes(column, value);
} }
} }
protected static class IntArrayMarshaller extends FieldMarshaller<int[]> { protected static class IntArrayMarshaller extends FieldMarshaller<int[]> {
public int[] getFromObject (Object po) @Override public int[] getFromObject (Object po)
throws IllegalArgumentException, IllegalAccessException { throws IllegalArgumentException, IllegalAccessException {
return (int[]) _field.get(po); return (int[]) _field.get(po);
} }
public int[] getFromSet (ResultSet rs) @Override public int[] getFromSet (ResultSet rs)
throws SQLException { throws SQLException {
return (int[]) rs.getObject(getColumnName()); return (int[]) rs.getObject(getColumnName());
} }
public void writeToObject (Object po, int[] value) @Override public void writeToObject (Object po, int[] value)
throws IllegalArgumentException, IllegalAccessException { throws IllegalArgumentException, IllegalAccessException {
_field.set(po, value); _field.set(po, value);
} }
public void writeToStatement (PreparedStatement ps, int column, int[] value) @Override public void writeToStatement (PreparedStatement ps, int column, int[] value)
throws SQLException { throws SQLException {
ps.setObject(column, value); ps.setObject(column, value);
} }
@@ -431,11 +431,11 @@ public abstract class FieldMarshaller<T>
} }
} }
public ByteEnum getFromObject (Object po) @Override public ByteEnum getFromObject (Object po)
throws IllegalArgumentException, IllegalAccessException { throws IllegalArgumentException, IllegalAccessException {
return (ByteEnum) _field.get(po); return (ByteEnum) _field.get(po);
} }
public ByteEnum getFromSet (ResultSet rs) @Override public ByteEnum getFromSet (ResultSet rs)
throws SQLException { throws SQLException {
try { try {
return (ByteEnum) _factmeth.invoke(null, rs.getByte(getColumnName())); return (ByteEnum) _factmeth.invoke(null, rs.getByte(getColumnName()));
@@ -445,11 +445,11 @@ public abstract class FieldMarshaller<T>
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }
public void writeToObject (Object po, ByteEnum value) @Override public void writeToObject (Object po, ByteEnum value)
throws IllegalArgumentException, IllegalAccessException { throws IllegalArgumentException, IllegalAccessException {
_field.set(po, value); _field.set(po, value);
} }
public void writeToStatement (PreparedStatement ps, int column, ByteEnum value) @Override public void writeToStatement (PreparedStatement ps, int column, ByteEnum value)
throws SQLException { throws SQLException {
ps.setByte(column, value.toByte()); ps.setByte(column, value.toByte());
} }
+2 -4
View File
@@ -75,8 +75,7 @@ public class Key<T extends PersistentRecord> extends WhereClause
return _values; return _values;
} }
@Override @Override public boolean equals (Object obj)
public boolean equals (Object obj)
{ {
if (this == obj) { if (this == obj) {
return true; return true;
@@ -88,8 +87,7 @@ public class Key<T extends PersistentRecord> extends WhereClause
return _pClass == other._pClass && _values.equals(other.getValues()); return _pClass == other._pClass && _values.equals(other.getValues());
} }
@Override @Override public int hashCode ()
public int hashCode ()
{ {
return _pClass.hashCode() ^ _values.hashCode(); return _pClass.hashCode() ^ _values.hashCode();
} }
@@ -41,7 +41,7 @@ public abstract class Modifier
super(null); super(null);
} }
public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException { @Override public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
Statement stmt = conn.createStatement(); Statement stmt = conn.createStatement();
try { try {
return stmt.executeUpdate(createQuery(liaison)); return stmt.executeUpdate(createQuery(liaison));
@@ -56,8 +56,7 @@ public class MySQLBuilder
{ {
public class MSBuildVisitor extends BuildVisitor public class MSBuildVisitor extends BuildVisitor
{ {
@Override @Override public void visit (FullTextMatch match)
public void visit (FullTextMatch match)
throws Exception throws Exception
{ {
_builder.append("match("); _builder.append("match(");
@@ -73,8 +72,7 @@ public class MySQLBuilder
_builder.append(") against (? in boolean mode)"); _builder.append(") against (? in boolean mode)");
} }
@Override @Override public void visit (DeleteClause<? extends PersistentRecord> deleteClause)
public void visit (DeleteClause<? extends PersistentRecord> deleteClause)
throws Exception throws Exception
{ {
_builder.append("delete from "); _builder.append("delete from ");
@@ -104,17 +102,17 @@ public class MySQLBuilder
super(types); super(types);
} }
protected void appendTableName (Class<? extends PersistentRecord> type) @Override protected void appendTableName (Class<? extends PersistentRecord> type)
{ {
_builder.append(_types.getTableName(type)); _builder.append(_types.getTableName(type));
} }
protected void appendTableAbbreviation (Class<? extends PersistentRecord> type) @Override protected void appendTableAbbreviation (Class<? extends PersistentRecord> type)
{ {
_builder.append(_types.getTableAbbreviation(type)); _builder.append(_types.getTableAbbreviation(type));
} }
protected void appendIdentifier (String field) @Override protected void appendIdentifier (String field)
{ {
_builder.append(field); _builder.append(field);
} }
@@ -127,8 +125,7 @@ public class MySQLBuilder
super(types, stmt); super(types, stmt);
} }
@Override @Override public void visit (FullTextMatch match)
public void visit (FullTextMatch match)
throws Exception throws Exception
{ {
_stmt.setString(_argIdx ++, match.getQuery()); _stmt.setString(_argIdx ++, match.getQuery());
@@ -58,8 +58,7 @@ public class PostgreSQLBuilder
{ {
public class PGBuildVisitor extends BuildVisitor public class PGBuildVisitor extends BuildVisitor
{ {
@Override @Override public void visit (FullTextMatch match)
public void visit (FullTextMatch match)
throws Exception throws Exception
{ {
appendIdentifier("ftsCol_" + match.getName()); appendIdentifier("ftsCol_" + match.getName());
@@ -79,7 +78,7 @@ public class PostgreSQLBuilder
super(types); super(types);
} }
protected void appendIdentifier (String field) @Override protected void appendIdentifier (String field)
{ {
_builder.append("\"").append(field).append("\""); _builder.append("\"").append(field).append("\"");
} }
@@ -87,8 +86,7 @@ public class PostgreSQLBuilder
public class PGBindVisitor extends BindVisitor public class PGBindVisitor extends BindVisitor
{ {
@Override @Override public void visit (FullTextMatch match)
public void visit (FullTextMatch match)
throws Exception throws Exception
{ {
// The tsearch2 engine takes queries on the form // The tsearch2 engine takes queries on the form
@@ -42,8 +42,7 @@ public abstract class Arithmetic
super(column, value); super(column, value);
} }
@Override @Override public String operator()
public String operator()
{ {
return "+"; return "+";
} }
@@ -62,8 +61,7 @@ public abstract class Arithmetic
super(column, value); super(column, value);
} }
@Override @Override public String operator()
public String operator()
{ {
return "-"; return "-";
} }
@@ -82,8 +80,7 @@ public abstract class Arithmetic
super(column, value); super(column, value);
} }
@Override @Override public String operator()
public String operator()
{ {
return "*"; return "*";
} }
@@ -102,8 +99,7 @@ public abstract class Arithmetic
super(column, value); super(column, value);
} }
@Override @Override public String operator()
public String operator()
{ {
return " / "; // Pad with spaces to work-around a MySQL bug. return " / "; // Pad with spaces to work-around a MySQL bug.
} }
@@ -122,8 +118,7 @@ public abstract class Arithmetic
super(column, value); super(column, value);
} }
@Override @Override public String operator()
public String operator()
{ {
return "&"; return "&";
} }
@@ -142,8 +137,7 @@ public abstract class Arithmetic
super(column, value); super(column, value);
} }
@Override @Override public String operator()
public String operator()
{ {
return "|"; return "|";
} }
@@ -85,8 +85,7 @@ public abstract class Conditionals
super(column, value); super(column, value);
} }
@Override @Override public String operator()
public String operator()
{ {
return "="; return "=";
} }
@@ -105,8 +104,7 @@ public abstract class Conditionals
super(column, value); super(column, value);
} }
@Override @Override public String operator()
public String operator()
{ {
return "!="; return "!=";
} }
@@ -125,8 +123,7 @@ public abstract class Conditionals
super(column, value); super(column, value);
} }
@Override @Override public String operator()
public String operator()
{ {
return "<"; return "<";
} }
@@ -145,8 +142,7 @@ public abstract class Conditionals
super(column, value); super(column, value);
} }
@Override @Override public String operator()
public String operator()
{ {
return "<="; return "<=";
} }
@@ -165,8 +161,7 @@ public abstract class Conditionals
super(column, value); super(column, value);
} }
@Override @Override public String operator()
public String operator()
{ {
return ">"; return ">";
} }
@@ -185,8 +180,7 @@ public abstract class Conditionals
super(column, value); super(column, value);
} }
@Override @Override public String operator()
public String operator()
{ {
return ">="; return ">=";
} }
@@ -260,8 +254,7 @@ public abstract class Conditionals
super(column, value); super(column, value);
} }
@Override @Override public String operator()
public String operator()
{ {
return " like "; return " like ";
} }
@@ -47,8 +47,7 @@ public abstract class Logic
super(conditions); super(conditions);
} }
@Override @Override public String operator()
public String operator()
{ {
return "or"; return "or";
} }
@@ -69,8 +68,7 @@ public abstract class Logic
super(conditions); super(conditions);
} }
@Override @Override public String operator()
public String operator()
{ {
return "and"; return "and";
} }
@@ -54,6 +54,7 @@ public class TestRecord extends PersistentRecord
@Column(nullable=false) @Column(nullable=false)
public Timestamp lastModified; public Timestamp lastModified;
@Override
public String toString () public String toString ()
{ {
return StringUtil.fieldsToString(this); return StringUtil.fieldsToString(this);
@@ -78,9 +78,7 @@ public class GenRecordTask extends Task
_cloader = ClasspathUtils.getClassLoaderForPath(getProject(), pathref); _cloader = ClasspathUtils.getClassLoaderForPath(getProject(), pathref);
} }
/** @Override
* Performs the actual work of the task.
*/
public void execute () throws BuildException public void execute () throws BuildException
{ {
if (_cloader == null) { if (_cloader == null) {
@@ -18,18 +18,17 @@
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
package com.samskivert.jdbc.jora; package com.samskivert.jdbc.jora;
/** This error is raised when error is happened during data transfer /** This error is raised when error is happened during data transfer
* between program and database server (for example IOException was thrown * between program and database server (for example IOException was thrown
* while operation with InputStream field) * while operation with InputStream field)
*/ */
public class DataTransferError extends java.lang.Error { public class DataTransferError extends java.lang.Error {
DataTransferError() { DataTransferError() {
super("Database data transfer error"); super("Database data transfer error");
} }
DataTransferError(Exception ex) { DataTransferError(Exception ex) {
super(ex.getMessage()); super(ex.getMessage());
} }
} }
@@ -135,6 +135,7 @@ public class FieldMask
* Creates a copy of this field mask, with all fields set to * Creates a copy of this field mask, with all fields set to
* not-modified. * not-modified.
*/ */
@Override
public Object clone () public Object clone ()
{ {
try { try {
@@ -146,7 +147,7 @@ public class FieldMask
} }
} }
// documentation inherited @Override
public String toString () public String toString ()
{ {
// return a list of the modified fields // return a list of the modified fields
+1 -3
View File
@@ -416,9 +416,7 @@ public class Table<T>
return nDeleted; return nDeleted;
} }
/** @Override
* Generates a string representation of this table.
*/
public String toString () public String toString ()
{ {
return "[name=" + name + return "[name=" + name +
@@ -52,7 +52,7 @@ public class HttpPostUtil
final ServiceWaiter<String> waiter = new ServiceWaiter<String>( final ServiceWaiter<String> waiter = new ServiceWaiter<String>(
(timeout < 0) ? ServiceWaiter.NO_TIMEOUT : timeout); (timeout < 0) ? ServiceWaiter.NO_TIMEOUT : timeout);
Thread tt = new Thread() { Thread tt = new Thread() {
public void run () { @Override public void run () {
try { try {
HttpURLConnection conn = HttpURLConnection conn =
(HttpURLConnection) url.openConnection(); (HttpURLConnection) url.openConnection();
@@ -179,7 +179,8 @@ public class JDBCTableSiteIdentifier implements SiteIdentifier
long now = System.currentTimeMillis(); long now = System.currentTimeMillis();
boolean reload = false; boolean reload = false;
synchronized (this) { synchronized (this) {
if (reload = (now - _lastReload > RELOAD_INTERVAL)) { reload = (now - _lastReload > RELOAD_INTERVAL);
if (reload) {
_lastReload = now; _lastReload = now;
} }
} }
@@ -306,8 +307,7 @@ public class JDBCTableSiteIdentifier implements SiteIdentifier
return other._rdomain.compareTo(_rdomain); return other._rdomain.compareTo(_rdomain);
} }
/** Returns a string representation of this site mapping. */ @Override public String toString ()
public String toString ()
{ {
return "[" + domain + " => " + siteId + "]"; return "[" + domain + " => " + siteId + "]";
} }
+1 -3
View File
@@ -49,9 +49,7 @@ public class Site
{ {
} }
/** @Override
* Generates a string representation of this instance.
*/
public String toString () public String toString ()
{ {
return StringUtil.fieldsToString(this); return StringUtil.fieldsToString(this);
@@ -174,9 +174,7 @@ public class SiteResourceLoader
} }
} }
/** @Override
* Returns a string representation of this instance.
*/
public String toString () public String toString ()
{ {
return "[jarPath=" + _jarPath + "]"; return "[jarPath=" + _jarPath + "]";
@@ -285,10 +283,7 @@ public class SiteResourceLoader
return _lastModified; return _lastModified;
} }
/** @Override public String toString ()
* Returns a string representation of this instance.
*/
public String toString ()
{ {
return "[bundle=" + file + "]"; return "[bundle=" + file + "]";
} }
@@ -337,7 +332,7 @@ public class SiteResourceLoader
_bundle = bundle; _bundle = bundle;
} }
public InputStream getResourceAsStream (String path) @Override public InputStream getResourceAsStream (String path)
{ {
try { try {
return _bundle.getResourceAsStream(path); return _bundle.getResourceAsStream(path);
@@ -349,7 +344,7 @@ public class SiteResourceLoader
} }
} }
public String toString () @Override public String toString ()
{ {
return _bundle.toString(); return _bundle.toString();
} }
@@ -45,6 +45,7 @@ public class SiteResourceLoaderTest extends TestCase
super(SiteResourceLoaderTest.class.getName()); super(SiteResourceLoaderTest.class.getName());
} }
@Override
public void runTest () public void runTest ()
{ {
// we need to fake a couple of things to get the test to work // we need to fake a couple of things to get the test to work
@@ -179,7 +179,7 @@ public class User
_dirty = dirty; _dirty = dirty;
} }
/** Returns a string representation of this instance. */ @Override
public String toString () public String toString ()
{ {
return StringUtil.fieldsToString(this); return StringUtil.fieldsToString(this);
@@ -141,7 +141,7 @@ public class UserManager
// register a cron job to prune the session table every hour // register a cron job to prune the session table every hour
_pruner = new Interval(pruneQueue) { _pruner = new Interval(pruneQueue) {
public void expired () { @Override public void expired () {
try { try {
_repository.pruneSessions(); _repository.pruneSessions();
} catch (PersistenceException pe) { } catch (PersistenceException pe) {
@@ -508,7 +508,7 @@ public class UserRepository extends JORARepository
return ids.toString(); return ids.toString();
} }
// documentation inherited @Override
protected void createTables () protected void createTables ()
{ {
// create our table object // create our table object
@@ -51,7 +51,7 @@ public class Username
return _username; return _username;
} }
/** Returns a string representation of this instance. */ @Override
public String toString () public String toString ()
{ {
return _username; return _username;
@@ -99,8 +99,7 @@ public class ExceptionMap
// method overloading // method overloading
final ArrayList<String> classes = new ArrayList<String>(); final ArrayList<String> classes = new ArrayList<String>();
Properties loader = new Properties() { Properties loader = new Properties() {
public Object put (Object key, Object value) @Override public Object put (Object key, Object value) {
{
classes.add((String)key); classes.add((String)key);
_values.add((String)value); _values.add((String)value);
return key; return key;
@@ -95,7 +95,7 @@ public class CollapsiblePanel extends JPanel
// When the content is shown, make sure it's scrolled visible // When the content is shown, make sure it's scrolled visible
_content.addComponentListener(new ComponentAdapter() { _content.addComponentListener(new ComponentAdapter() {
public void componentShown (ComponentEvent event) @Override public void componentShown (ComponentEvent event)
{ {
// we can't do it just yet, the content doesn't know its size // we can't do it just yet, the content doesn't know its size
EventQueue.invokeLater(new Runnable() { EventQueue.invokeLater(new Runnable() {
@@ -107,7 +107,7 @@ public class ComboButtonBox extends JPanel
addButtons(0, _model.getSize()); addButtons(0, _model.getSize());
} }
// documentation inherited @Override
public void setEnabled (boolean enabled) public void setEnabled (boolean enabled)
{ {
super.setEnabled(enabled); super.setEnabled(enabled);
@@ -47,7 +47,7 @@ public class CommandButton extends JButton
return _argument; return _argument;
} }
// documentation inherited @Override
protected void fireActionPerformed (ActionEvent event) protected void fireActionPerformed (ActionEvent event)
{ {
Object[] listeners = listenerList.getListenerList(); Object[] listeners = listenerList.getListenerList();
@@ -47,6 +47,7 @@ public class DimenInfo
public Dimension[] dimens; public Dimension[] dimens;
@Override
public String toString () public String toString ()
{ {
StringBuilder buf = new StringBuilder(); StringBuilder buf = new StringBuilder();
@@ -48,7 +48,7 @@ public class GroupLayoutTest
frame.addWindowListener(new WindowAdapter () frame.addWindowListener(new WindowAdapter ()
{ {
public void windowClosing (WindowEvent e) @Override public void windowClosing (WindowEvent e)
{ {
System.exit(0); System.exit(0);
} }
@@ -55,6 +55,7 @@ public class HGroupLayout extends GroupLayout
{ {
} }
@Override
protected Dimension getLayoutSize (Container parent, int type) protected Dimension getLayoutSize (Container parent, int type)
{ {
DimenInfo info = computeDimens(parent, type); DimenInfo info = computeDimens(parent, type);
@@ -80,6 +81,7 @@ public class HGroupLayout extends GroupLayout
return dims; return dims;
} }
@Override
public void layoutContainer (Container parent) public void layoutContainer (Container parent)
{ {
Rectangle b = parent.getBounds(); Rectangle b = parent.getBounds();
+4 -5
View File
@@ -90,7 +90,7 @@ public class IntField extends JTextField
// remove operation is modified to do the sneaky highlighting we do. // remove operation is modified to do the sneaky highlighting we do.
final IntDocument doc = (IntDocument) getDocument(); final IntDocument doc = (IntDocument) getDocument();
doc.setDocumentFilter(new DocumentFilter() { doc.setDocumentFilter(new DocumentFilter() {
public void remove (FilterBypass fb, int offset, int length) @Override public void remove (FilterBypass fb, int offset, int length)
throws BadLocationException throws BadLocationException
{ {
String current = doc.getText(0, doc.getLength()); String current = doc.getText(0, doc.getLength());
@@ -131,7 +131,7 @@ public class IntField extends JTextField
setSelectionStart(selStart - 1); setSelectionStart(selStart - 1);
} }
public void insertString (FilterBypass fb, int offset, @Override public void insertString (FilterBypass fb, int offset,
String s, AttributeSet attr) String s, AttributeSet attr)
throws BadLocationException throws BadLocationException
{ {
@@ -141,7 +141,7 @@ public class IntField extends JTextField
transform(fb, current, potential); transform(fb, current, potential);
} }
public void replace (FilterBypass fb, int offset, int length, @Override public void replace (FilterBypass fb, int offset, int length,
String text, AttributeSet attrs) String text, AttributeSet attrs)
throws BadLocationException throws BadLocationException
{ {
@@ -327,8 +327,7 @@ public class IntField extends JTextField
*/ */
protected static class IntDocument extends PlainDocument protected static class IntDocument extends PlainDocument
{ {
// documentation inherited @Override protected void fireRemoveUpdate (DocumentEvent e)
protected void fireRemoveUpdate (DocumentEvent e)
{ {
// suppress: the DocumentFilter implements replace by doing // suppress: the DocumentFilter implements replace by doing
// a remove and then an insert. We do not want listeners to ever // a remove and then an insert. We do not want listeners to ever
@@ -36,7 +36,7 @@ public class IntegerTableCellRenderer extends DefaultTableCellRenderer
setHorizontalAlignment(RIGHT); setHorizontalAlignment(RIGHT);
} }
// documentation inherited @Override
protected void setValue (Object value) protected void setValue (Object value)
{ {
if ((value instanceof Integer) || (value instanceof Long)) { if ((value instanceof Integer) || (value instanceof Long)) {
@@ -52,7 +52,7 @@ public class LazyComponent extends JComponent
_creator = creator; _creator = creator;
} }
// documentation inherited @Override
public void addNotify () public void addNotify ()
{ {
super.addNotify(); super.addNotify();
@@ -60,7 +60,7 @@ public class LazyComponent extends JComponent
checkCreate(); checkCreate();
} }
// documentation inherited @Override
public void setVisible (boolean vis) public void setVisible (boolean vis)
{ {
super.setVisible(vis); super.setVisible(vis);
@@ -218,7 +218,7 @@ public class MultiLineLabel extends JComponent
repaint(); repaint();
} }
// documentation inherited @Override
public void paintComponent (Graphics g) public void paintComponent (Graphics g)
{ {
super.paintComponent(g); super.paintComponent(g);
@@ -260,7 +260,7 @@ public class MultiLineLabel extends JComponent
} }
} }
// documentation inherited @Override
public void doLayout () public void doLayout ()
{ {
super.doLayout(); super.doLayout();
@@ -345,7 +345,7 @@ public class MultiLineLabel extends JComponent
} }
} }
// documentation inherited @Override
public Dimension getPreferredSize () public Dimension getPreferredSize ()
{ {
if (isPreferredSizeSet()) { if (isPreferredSizeSet()) {
@@ -326,20 +326,17 @@ public class ObjectEditorTable extends JTable
return _data.size(); return _data.size();
} }
// documentation inherited @Override public String getColumnName (int col)
public String getColumnName (int col)
{ {
return _interp.getName(_fields[col]); return _interp.getName(_fields[col]);
} }
// documentation inherited @Override public boolean isCellEditable (int row, int col)
public boolean isCellEditable (int row, int col)
{ {
return _editable.get(col); return _editable.get(col);
} }
// documentation inherited @Override public Class<?> getColumnClass (int col)
public Class<?> getColumnClass (int col)
{ {
return _interp.getClass(_fields[col]); return _interp.getClass(_fields[col]);
} }
@@ -351,8 +348,7 @@ public class ObjectEditorTable extends JTable
return _interp.getValue(o, _fields[col]); return _interp.getValue(o, _fields[col]);
} }
// documentation inherited @Override public void setValueAt (Object value, int row, int col)
public void setValueAt (Object value, int row, int col)
{ {
Object o = getObjectAt(row); Object o = getObjectAt(row);
Object oldValue = _interp.getValue(o, _fields[col]); Object oldValue = _interp.getValue(o, _fields[col]);
@@ -113,7 +113,7 @@ public class RadialLabelSausage extends LabelSausage
closedBounds.height = closedBounds.width = _size.height; closedBounds.height = closedBounds.width = _size.height;
} }
// documentation inherited @Override
protected void drawLabel (Graphics2D gfx, int x, int y) protected void drawLabel (Graphics2D gfx, int x, int y)
{ {
if (_active) { if (_active) {
@@ -121,7 +121,7 @@ public class RadialLabelSausage extends LabelSausage
} }
} }
// documentation inherited @Override
protected void drawBorder (Graphics2D gfx, int x, int y) protected void drawBorder (Graphics2D gfx, int x, int y)
{ {
// then around all that draw the borders // then around all that draw the borders
@@ -156,7 +156,7 @@ public class RadialLabelSausage extends LabelSausage
} }
} }
// documentation inherited @Override
protected void drawExtras (Graphics2D gfx, int x, int y, Object cliData) protected void drawExtras (Graphics2D gfx, int x, int y, Object cliData)
{ {
RadialMenu menu = (RadialMenu) cliData; RadialMenu menu = (RadialMenu) cliData;
@@ -174,6 +174,7 @@ public class RadialLabelSausage extends LabelSausage
* Draw the base circle or sausage within which all the other * Draw the base circle or sausage within which all the other
* decorations are added. * decorations are added.
*/ */
@Override
protected void drawBase (Graphics2D gfx, int x, int y) protected void drawBase (Graphics2D gfx, int x, int y)
{ {
if (_active) { if (_active) {
@@ -93,6 +93,7 @@ public class RadialMenuItem extends RadialLabelSausage
* displayed. Calls through to the {@link RadialMenu.Predicate} if we * displayed. Calls through to the {@link RadialMenu.Predicate} if we
* have one. * have one.
*/ */
@Override
public boolean isEnabled (RadialMenu menu) public boolean isEnabled (RadialMenu menu)
{ {
return (predicate == null || predicate.isEnabled(menu, this)); return (predicate == null || predicate.isEnabled(menu, this));
@@ -103,6 +104,7 @@ public class RadialMenuItem extends RadialLabelSausage
* declare ourselves to be equal to a string with the same value * declare ourselves to be equal to a string with the same value
* as our command. * as our command.
*/ */
@Override
public boolean equals (Object other) public boolean equals (Object other)
{ {
if (other instanceof RadialMenuItem) { if (other instanceof RadialMenuItem) {
@@ -123,7 +125,7 @@ public class RadialMenuItem extends RadialLabelSausage
paint(gfx, x, y, menu); paint(gfx, x, y, menu);
} }
// documentation inherited @Override
protected void drawIcon (Graphics2D gfx, int x, int y, Object cliData) protected void drawIcon (Graphics2D gfx, int x, int y, Object cliData)
{ {
super.drawIcon(gfx, x, y, cliData); super.drawIcon(gfx, x, y, cliData);
@@ -177,7 +177,7 @@ public class RuntimeAdjust
_config.setValue(_name, value); _config.setValue(_name, value);
} }
protected void populateEditor (JPanel editor) @Override protected void populateEditor (JPanel editor)
{ {
editor.add(_valbox = new JCheckBox(), GroupLayout.FIXED); editor.add(_valbox = new JCheckBox(), GroupLayout.FIXED);
_valbox.setSelected(getValue()); _valbox.setSelected(getValue());
@@ -226,7 +226,7 @@ public class RuntimeAdjust
_config.setValue(_name, value); _config.setValue(_name, value);
} }
protected void populateEditor (JPanel editor) @Override protected void populateEditor (JPanel editor)
{ {
super.populateEditor(editor); super.populateEditor(editor);
_valbox.setText("" + getValue()); _valbox.setText("" + getValue());
@@ -287,7 +287,7 @@ public class RuntimeAdjust
} }
} }
protected void populateEditor (JPanel editor) @Override protected void populateEditor (JPanel editor)
{ {
editor.add(_valbox = new JComboBox(_values), GroupLayout.FIXED); editor.add(_valbox = new JComboBox(_values), GroupLayout.FIXED);
_valbox.addActionListener(this); _valbox.addActionListener(this);
@@ -341,7 +341,7 @@ public class RuntimeAdjust
_config.setValue(_name, value); _config.setValue(_name, value);
} }
protected void populateEditor (JPanel editor) @Override protected void populateEditor (JPanel editor)
{ {
// set up the label // set up the label
JPanel p = GroupLayout.makeVBox(); JPanel p = GroupLayout.makeVBox();
@@ -418,7 +418,7 @@ public class RuntimeAdjust
super(descrip, name, null); super(descrip, name, null);
} }
protected void populateEditor (JPanel editor) @Override protected void populateEditor (JPanel editor)
{ {
JButton actbut = new JButton("Go"); JButton actbut = new JButton("Go");
editor.add(actbut, GroupLayout.FIXED); editor.add(actbut, GroupLayout.FIXED);
@@ -447,8 +447,7 @@ public class RuntimeAdjust
super(descrip, name, config); super(descrip, name, config);
} }
// documentation inherited @Override protected void populateEditor (JPanel editor)
protected void populateEditor (JPanel editor)
{ {
editor.add(_valbox = new JTextField(), GroupLayout.FIXED); editor.add(_valbox = new JTextField(), GroupLayout.FIXED);
_valbox.addFocusListener(this); _valbox.addFocusListener(this);
@@ -505,7 +504,7 @@ public class RuntimeAdjust
_adjusts.insertSorted(this); // keep 'em sorted _adjusts.insertSorted(this); // keep 'em sorted
} }
public boolean equals (Object other) @Override public boolean equals (Object other)
{ {
return _name.equals(((Adjust)other)._name); return _name.equals(((Adjust)other)._name);
} }
@@ -554,7 +553,7 @@ public class RuntimeAdjust
protected abstract void populateEditor (JPanel editor); protected abstract void populateEditor (JPanel editor);
public String toString () @Override public String toString ()
{ {
return StringUtil.shortClassName(this) + return StringUtil.shortClassName(this) +
"[name=" + _name + ", desc=" + _descrip + "]"; "[name=" + _name + ", desc=" + _descrip + "]";
@@ -30,6 +30,7 @@ import javax.swing.JLayeredPane;
*/ */
public class SafeLayeredPane extends JLayeredPane public class SafeLayeredPane extends JLayeredPane
{ {
@Override
public void remove (int index) public void remove (int index)
{ {
Component c = getComponent(index); Component c = getComponent(index);
+7 -10
View File
@@ -62,7 +62,7 @@ public class ScrollBox extends JPanel
addMouseMotionListener(_mouser); addMouseMotionListener(_mouser);
} }
// documentation inherited @Override
public void addNotify () public void addNotify ()
{ {
super.addNotify(); super.addNotify();
@@ -73,7 +73,7 @@ public class ScrollBox extends JPanel
updateBox(); updateBox();
} }
// documentation inherited @Override
public void removeNotify () public void removeNotify ()
{ {
super.removeNotify(); super.removeNotify();
@@ -82,7 +82,7 @@ public class ScrollBox extends JPanel
_vert.removeChangeListener(_changebob); _vert.removeChangeListener(_changebob);
} }
// documentation inherited @Override
public void setBounds (int x, int y, int w, int h) public void setBounds (int x, int y, int w, int h)
{ {
super.setBounds(x, y, w, h); super.setBounds(x, y, w, h);
@@ -90,7 +90,7 @@ public class ScrollBox extends JPanel
updateBox(); updateBox();
} }
// documentation inherited @Override
public void paintComponent (Graphics g) public void paintComponent (Graphics g)
{ {
paintBackground(g); paintBackground(g);
@@ -169,8 +169,7 @@ public class ScrollBox extends JPanel
*/ */
protected MouseInputAdapter _mouser = new MouseInputAdapter () protected MouseInputAdapter _mouser = new MouseInputAdapter ()
{ {
// documentation inherited @Override public void mousePressed (MouseEvent e)
public void mousePressed (MouseEvent e)
{ {
if (isActiveButton(e)) { if (isActiveButton(e)) {
setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR)); setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
@@ -186,8 +185,7 @@ public class ScrollBox extends JPanel
} }
} }
// documentation inherited @Override public void mouseDragged (MouseEvent e)
public void mouseDragged (MouseEvent e)
{ {
if (_lastPoint != null) { if (_lastPoint != null) {
Point p = e.getPoint(); Point p = e.getPoint();
@@ -197,8 +195,7 @@ public class ScrollBox extends JPanel
} }
} }
// documentation inherited @Override public void mouseReleased (MouseEvent e)
public void mouseReleased (MouseEvent e)
{ {
if (isActiveButton(e)) { if (isActiveButton(e)) {
setCursor(null); setCursor(null);
@@ -76,7 +76,7 @@ public class SimpleSlider extends JPanel
} }
} }
// documentation inherited @Override
public void setFont (Font font) public void setFont (Font font)
{ {
super.setFont(font); super.setFont(font);
@@ -34,6 +34,7 @@ public class SmartPolygon extends Polygon
* Returns the internally cached bounds rectangle for this polygon. * Returns the internally cached bounds rectangle for this polygon.
* <em>Don't modify it!</em> * <em>Don't modify it!</em>
*/ */
@Override
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public Rectangle getBoundingBox () public Rectangle getBoundingBox ()
{ {
@@ -75,313 +75,368 @@ public class TGraphics2D extends Graphics2D
return _primary; return _primary;
} }
@Override
public void draw3DRect (int x, int y, int w, int h, boolean r) public void draw3DRect (int x, int y, int w, int h, boolean r)
{ {
_copy.draw3DRect(x, y, w, h, r); _copy.draw3DRect(x, y, w, h, r);
_primary.draw3DRect(x, y, w, h, r); _primary.draw3DRect(x, y, w, h, r);
} }
@Override
public void fill3DRect (int x, int y, int w, int h, boolean r) public void fill3DRect (int x, int y, int w, int h, boolean r)
{ {
_copy.fill3DRect(x, y, w, h, r); _copy.fill3DRect(x, y, w, h, r);
_primary.fill3DRect(x, y, w, h, r); _primary.fill3DRect(x, y, w, h, r);
} }
@Override
public void draw (Shape s) public void draw (Shape s)
{ {
_copy.draw(s); _copy.draw(s);
_primary.draw(s); _primary.draw(s);
} }
@Override
public boolean drawImage (Image i, AffineTransform a, ImageObserver o) public boolean drawImage (Image i, AffineTransform a, ImageObserver o)
{ {
_copy.drawImage(i, a, null); _copy.drawImage(i, a, null);
return _primary.drawImage(i, a, o); return _primary.drawImage(i, a, o);
} }
@Override
public void drawImage (BufferedImage i, BufferedImageOp o, int x, int y) public void drawImage (BufferedImage i, BufferedImageOp o, int x, int y)
{ {
_copy.drawImage(i, o, x, y); _copy.drawImage(i, o, x, y);
_primary.drawImage(i, o, x, y); _primary.drawImage(i, o, x, y);
} }
@Override
public void drawRenderedImage (RenderedImage i, AffineTransform a) public void drawRenderedImage (RenderedImage i, AffineTransform a)
{ {
_copy.drawRenderedImage(i, a); _copy.drawRenderedImage(i, a);
_primary.drawRenderedImage(i, a); _primary.drawRenderedImage(i, a);
} }
@Override
public void drawRenderableImage (RenderableImage i, AffineTransform a) public void drawRenderableImage (RenderableImage i, AffineTransform a)
{ {
_copy.drawRenderableImage(i, a); _copy.drawRenderableImage(i, a);
_primary.drawRenderableImage(i, a); _primary.drawRenderableImage(i, a);
} }
@Override
public void drawString (String s, int x, int y) public void drawString (String s, int x, int y)
{ {
_copy.drawString(s, x, y); _copy.drawString(s, x, y);
_primary.drawString(s, x, y); _primary.drawString(s, x, y);
} }
@Override
public void drawString (String s, float x, float y) public void drawString (String s, float x, float y)
{ {
_copy.drawString(s, x, y); _copy.drawString(s, x, y);
_primary.drawString(s, x, y); _primary.drawString(s, x, y);
} }
@Override
public void drawString (AttributedCharacterIterator i, int x, int y) public void drawString (AttributedCharacterIterator i, int x, int y)
{ {
_copy.drawString(i, x, y); _copy.drawString(i, x, y);
_primary.drawString(i, x, y); _primary.drawString(i, x, y);
} }
@Override
public void drawString (AttributedCharacterIterator i, float x, float y) public void drawString (AttributedCharacterIterator i, float x, float y)
{ {
_copy.drawString(i, x, y); _copy.drawString(i, x, y);
_primary.drawString(i, x, y); _primary.drawString(i, x, y);
} }
@Override
public void drawGlyphVector (GlyphVector g, float x, float y) public void drawGlyphVector (GlyphVector g, float x, float y)
{ {
_copy.drawGlyphVector(g, x, y); _copy.drawGlyphVector(g, x, y);
_primary.drawGlyphVector(g, x, y); _primary.drawGlyphVector(g, x, y);
} }
@Override
public void fill (Shape s) public void fill (Shape s)
{ {
_copy.fill(s); _copy.fill(s);
_primary.fill(s); _primary.fill(s);
} }
@Override
public boolean hit (Rectangle r, Shape s, boolean x) public boolean hit (Rectangle r, Shape s, boolean x)
{ {
_copy.hit(r, s, x); _copy.hit(r, s, x);
return _primary.hit(r, s, x); return _primary.hit(r, s, x);
} }
@Override
public GraphicsConfiguration getDeviceConfiguration () public GraphicsConfiguration getDeviceConfiguration ()
{ {
return _primary.getDeviceConfiguration(); return _primary.getDeviceConfiguration();
} }
@Override
public void setComposite (Composite c) public void setComposite (Composite c)
{ {
_copy.setComposite(c); _copy.setComposite(c);
_primary.setComposite(c); _primary.setComposite(c);
} }
@Override
public void setPaint (Paint p) public void setPaint (Paint p)
{ {
_copy.setPaint(p); _copy.setPaint(p);
_primary.setPaint(p); _primary.setPaint(p);
} }
@Override
public void setStroke (Stroke s) public void setStroke (Stroke s)
{ {
_copy.setStroke(s); _copy.setStroke(s);
_primary.setStroke(s); _primary.setStroke(s);
} }
@Override
public void setRenderingHint (RenderingHints.Key k, Object v) public void setRenderingHint (RenderingHints.Key k, Object v)
{ {
_copy.setRenderingHint(k, v); _copy.setRenderingHint(k, v);
_primary.setRenderingHint(k, v); _primary.setRenderingHint(k, v);
} }
@Override
public Object getRenderingHint (RenderingHints.Key k) public Object getRenderingHint (RenderingHints.Key k)
{ {
return _primary.getRenderingHint(k); return _primary.getRenderingHint(k);
} }
@Override
public void setRenderingHints (Map<?, ?> m) public void setRenderingHints (Map<?, ?> m)
{ {
_copy.setRenderingHints(m); _copy.setRenderingHints(m);
_primary.setRenderingHints(m); _primary.setRenderingHints(m);
} }
@Override
public void addRenderingHints (Map<?, ?> m) public void addRenderingHints (Map<?, ?> m)
{ {
_copy.addRenderingHints(m); _copy.addRenderingHints(m);
_primary.addRenderingHints(m); _primary.addRenderingHints(m);
} }
@Override
public RenderingHints getRenderingHints () public RenderingHints getRenderingHints ()
{ {
return _primary.getRenderingHints(); return _primary.getRenderingHints();
} }
@Override
public void translate (int x, int y) public void translate (int x, int y)
{ {
_copy.translate(x, y); _copy.translate(x, y);
_primary.translate(x, y); _primary.translate(x, y);
} }
@Override
public void translate (double x, double y) public void translate (double x, double y)
{ {
_copy.translate(x, y); _copy.translate(x, y);
_primary.translate(x, y); _primary.translate(x, y);
} }
@Override
public void rotate (double t) public void rotate (double t)
{ {
_copy.rotate(t); _copy.rotate(t);
_primary.rotate(t); _primary.rotate(t);
} }
@Override
public void rotate (double t, double u, double v) public void rotate (double t, double u, double v)
{ {
_copy.rotate(t, u, v); _copy.rotate(t, u, v);
_primary.rotate(t, u, v); _primary.rotate(t, u, v);
} }
@Override
public void scale (double x, double y) public void scale (double x, double y)
{ {
_copy.scale(x, y); _copy.scale(x, y);
_primary.scale(x, y); _primary.scale(x, y);
} }
@Override
public void shear (double x, double y) public void shear (double x, double y)
{ {
_copy.shear(x, y); _copy.shear(x, y);
_primary.shear(x, y); _primary.shear(x, y);
} }
@Override
public void transform (AffineTransform a) public void transform (AffineTransform a)
{ {
_copy.transform(a); _copy.transform(a);
_primary.transform(a); _primary.transform(a);
} }
@Override
public void setTransform (AffineTransform a) public void setTransform (AffineTransform a)
{ {
_copy.setTransform(a); _copy.setTransform(a);
_primary.setTransform(a); _primary.setTransform(a);
} }
@Override
public AffineTransform getTransform () public AffineTransform getTransform ()
{ {
return _primary.getTransform(); return _primary.getTransform();
} }
@Override
public Paint getPaint () public Paint getPaint ()
{ {
return _primary.getPaint(); return _primary.getPaint();
} }
@Override
public Composite getComposite () public Composite getComposite ()
{ {
return _primary.getComposite(); return _primary.getComposite();
} }
@Override
public void setBackground (Color c) public void setBackground (Color c)
{ {
_copy.setBackground(c); _copy.setBackground(c);
_primary.setBackground(c); _primary.setBackground(c);
} }
@Override
public Color getBackground () public Color getBackground ()
{ {
return _primary.getBackground(); return _primary.getBackground();
} }
@Override
public Stroke getStroke () public Stroke getStroke ()
{ {
return _primary.getStroke(); return _primary.getStroke();
} }
@Override
public void clip (Shape s) public void clip (Shape s)
{ {
_copy.clip(s); _copy.clip(s);
_primary.clip(s); _primary.clip(s);
} }
@Override
public FontRenderContext getFontRenderContext () public FontRenderContext getFontRenderContext ()
{ {
return _primary.getFontRenderContext(); return _primary.getFontRenderContext();
} }
@Override
public Graphics create () public Graphics create ()
{ {
return _primary.create(); return _primary.create();
} }
@Override
public Graphics create (int x, int y, int w, int h) public Graphics create (int x, int y, int w, int h)
{ {
return _primary.create(x, y, w, h); return _primary.create(x, y, w, h);
} }
@Override
public Color getColor () public Color getColor ()
{ {
return _primary.getColor(); return _primary.getColor();
} }
@Override
public void setColor (Color c) public void setColor (Color c)
{ {
_copy.setColor(c); _copy.setColor(c);
_primary.setColor(c); _primary.setColor(c);
} }
@Override
public void setPaintMode () public void setPaintMode ()
{ {
_copy.setPaintMode(); _copy.setPaintMode();
_primary.setPaintMode(); _primary.setPaintMode();
} }
@Override
public void setXORMode (Color c) public void setXORMode (Color c)
{ {
_copy.setXORMode(c); _copy.setXORMode(c);
_primary.setXORMode(c); _primary.setXORMode(c);
} }
@Override
public Font getFont () public Font getFont ()
{ {
return _primary.getFont(); return _primary.getFont();
} }
@Override
public void setFont (Font f) public void setFont (Font f)
{ {
_copy.setFont(f); _copy.setFont(f);
_primary.setFont(f); _primary.setFont(f);
} }
@Override
public FontMetrics getFontMetrics () public FontMetrics getFontMetrics ()
{ {
return _primary.getFontMetrics(); return _primary.getFontMetrics();
} }
@Override
public FontMetrics getFontMetrics (Font f) public FontMetrics getFontMetrics (Font f)
{ {
return _primary.getFontMetrics(f); return _primary.getFontMetrics(f);
} }
@Override
public Rectangle getClipBounds () public Rectangle getClipBounds ()
{ {
return _primary.getClipBounds(); return _primary.getClipBounds();
} }
@Override
public void clipRect (int x, int y, int w, int h) public void clipRect (int x, int y, int w, int h)
{ {
_copy.clipRect(x, y, w, h); _copy.clipRect(x, y, w, h);
_primary.clipRect(x, y, w, h); _primary.clipRect(x, y, w, h);
} }
@Override
public void setClip (int x, int y, int w, int h) public void setClip (int x, int y, int w, int h)
{ {
_copy.setClip(x, y, w, h); _copy.setClip(x, y, w, h);
_primary.setClip(x, y, w, h); _primary.setClip(x, y, w, h);
} }
@Override
public Shape getClip () public Shape getClip ()
{ {
return _primary.getClip(); return _primary.getClip();
} }
@Override
public void setClip (Shape s) public void setClip (Shape s)
{ {
_copy.setClip(s); _copy.setClip(s);
_primary.setClip(s); _primary.setClip(s);
} }
@Override
public void copyArea (int x, int y, int w, int h, int a, int b) public void copyArea (int x, int y, int w, int h, int a, int b)
{ {
// was seeing errors here, Don't worry about failure on copy // was seeing errors here, Don't worry about failure on copy
@@ -392,114 +447,133 @@ public class TGraphics2D extends Graphics2D
_primary.copyArea(x, y, w, h, a, b); _primary.copyArea(x, y, w, h, a, b);
} }
@Override
public void drawLine (int x, int y, int a, int b) public void drawLine (int x, int y, int a, int b)
{ {
_copy.drawLine(x, y, a, b); _copy.drawLine(x, y, a, b);
_primary.drawLine(x, y, a, b); _primary.drawLine(x, y, a, b);
} }
@Override
public void fillRect (int x, int y, int w, int h) public void fillRect (int x, int y, int w, int h)
{ {
_copy.fillRect(x, y, w, h); _copy.fillRect(x, y, w, h);
_primary.fillRect(x, y, w, h); _primary.fillRect(x, y, w, h);
} }
@Override
public void drawRect (int x, int y, int w, int h) public void drawRect (int x, int y, int w, int h)
{ {
_copy.drawRect(x, y, w, h); _copy.drawRect(x, y, w, h);
_primary.drawRect(x, y, w, h); _primary.drawRect(x, y, w, h);
} }
@Override
public void clearRect (int x, int y, int w, int h) public void clearRect (int x, int y, int w, int h)
{ {
_copy.clearRect(x, y, w, h); _copy.clearRect(x, y, w, h);
_primary.clearRect(x, y, w, h); _primary.clearRect(x, y, w, h);
} }
@Override
public void drawRoundRect (int x, int y, int w, int h, int a, int b) public void drawRoundRect (int x, int y, int w, int h, int a, int b)
{ {
_copy.drawRoundRect(x, y, w, h, a, b); _copy.drawRoundRect(x, y, w, h, a, b);
_primary.drawRoundRect(x, y, w, h, a, b); _primary.drawRoundRect(x, y, w, h, a, b);
} }
@Override
public void fillRoundRect (int x, int y, int w, int h, int a, int b) public void fillRoundRect (int x, int y, int w, int h, int a, int b)
{ {
_copy.fillRoundRect(x, y, w, h, a, b); _copy.fillRoundRect(x, y, w, h, a, b);
_primary.fillRoundRect(x, y, w, h, a, b); _primary.fillRoundRect(x, y, w, h, a, b);
} }
@Override
public void drawOval (int x, int y, int w, int h) public void drawOval (int x, int y, int w, int h)
{ {
_copy.drawOval(x, y, w, h); _copy.drawOval(x, y, w, h);
_primary.drawOval(x, y, w, h); _primary.drawOval(x, y, w, h);
} }
@Override
public void fillOval (int x, int y, int w, int h) public void fillOval (int x, int y, int w, int h)
{ {
_copy.fillOval(x, y, w, h); _copy.fillOval(x, y, w, h);
_primary.fillOval(x, y, w, h); _primary.fillOval(x, y, w, h);
} }
@Override
public void drawArc (int x, int y, int w, int h, int a, int b) public void drawArc (int x, int y, int w, int h, int a, int b)
{ {
_copy.drawArc(x, y, w, h, a, b); _copy.drawArc(x, y, w, h, a, b);
_primary.drawArc(x, y, w, h, a, b); _primary.drawArc(x, y, w, h, a, b);
} }
@Override
public void fillArc (int x, int y, int w, int h, int a, int b) public void fillArc (int x, int y, int w, int h, int a, int b)
{ {
_copy.fillArc(x, y, w, h, a, b); _copy.fillArc(x, y, w, h, a, b);
_primary.fillArc(x, y, w, h, a, b); _primary.fillArc(x, y, w, h, a, b);
} }
@Override
public void drawPolyline (int[] x, int[] y, int n) public void drawPolyline (int[] x, int[] y, int n)
{ {
_copy.drawPolyline(x, y, n); _copy.drawPolyline(x, y, n);
_primary.drawPolyline(x, y, n); _primary.drawPolyline(x, y, n);
} }
@Override
public void drawPolygon (int[] x, int[] y, int n) public void drawPolygon (int[] x, int[] y, int n)
{ {
_copy.drawPolygon(x, y, n); _copy.drawPolygon(x, y, n);
_primary.drawPolygon(x, y, n); _primary.drawPolygon(x, y, n);
} }
@Override
public void drawPolygon (Polygon p) public void drawPolygon (Polygon p)
{ {
_copy.drawPolygon(p); _copy.drawPolygon(p);
_primary.drawPolygon(p); _primary.drawPolygon(p);
} }
@Override
public void fillPolygon (int[] x, int[] y, int n) public void fillPolygon (int[] x, int[] y, int n)
{ {
_copy.fillPolygon(x, y, n); _copy.fillPolygon(x, y, n);
_primary.fillPolygon(x, y, n); _primary.fillPolygon(x, y, n);
} }
@Override
public void fillPolygon (Polygon p) public void fillPolygon (Polygon p)
{ {
_copy.fillPolygon(p); _copy.fillPolygon(p);
_primary.fillPolygon(p); _primary.fillPolygon(p);
} }
@Override
public void drawChars (char[] c, int x, int y, int w, int h) public void drawChars (char[] c, int x, int y, int w, int h)
{ {
_copy.drawChars(c, x, y, w, h); _copy.drawChars(c, x, y, w, h);
_primary.drawChars(c, x, y, w, h); _primary.drawChars(c, x, y, w, h);
} }
@Override
public void drawBytes (byte[] b, int x, int y, int w, int h) public void drawBytes (byte[] b, int x, int y, int w, int h)
{ {
_copy.drawBytes(b, x, y, w, h); _copy.drawBytes(b, x, y, w, h);
_primary.drawBytes(b, x, y, w, h); _primary.drawBytes(b, x, y, w, h);
} }
@Override
public boolean drawImage (Image i, int x, int y, ImageObserver o) public boolean drawImage (Image i, int x, int y, ImageObserver o)
{ {
_copy.drawImage(i, x, y, null); _copy.drawImage(i, x, y, null);
return _primary.drawImage(i, x, y, o); return _primary.drawImage(i, x, y, o);
} }
@Override
public boolean drawImage ( public boolean drawImage (
Image i, int x, int y, int w, int h, ImageObserver o) Image i, int x, int y, int w, int h, ImageObserver o)
{ {
@@ -507,12 +581,14 @@ public class TGraphics2D extends Graphics2D
return _primary.drawImage(i, x, y, w, h, o); return _primary.drawImage(i, x, y, w, h, o);
} }
@Override
public boolean drawImage (Image i, int x, int y, Color c, ImageObserver o) public boolean drawImage (Image i, int x, int y, Color c, ImageObserver o)
{ {
_copy.drawImage(i, x, y, c, null); _copy.drawImage(i, x, y, c, null);
return _primary.drawImage(i, x, y, c, o); return _primary.drawImage(i, x, y, c, o);
} }
@Override
public boolean drawImage ( public boolean drawImage (
Image i, int x, int y, int w, int h, Color c, ImageObserver o) Image i, int x, int y, int w, int h, Color c, ImageObserver o)
{ {
@@ -520,6 +596,7 @@ public class TGraphics2D extends Graphics2D
return _primary.drawImage(i, x, y, w, h, c, o); return _primary.drawImage(i, x, y, w, h, c, o);
} }
@Override
public boolean drawImage ( public boolean drawImage (
Image i, int x, int y, int w, int h, Image i, int x, int y, int w, int h,
int a, int b, int c, int d, ImageObserver o) int a, int b, int c, int d, ImageObserver o)
@@ -528,6 +605,7 @@ public class TGraphics2D extends Graphics2D
return _primary.drawImage(i, x, y, w, h, a, b, c, d, o); return _primary.drawImage(i, x, y, w, h, a, b, c, d, o);
} }
@Override
public boolean drawImage ( public boolean drawImage (
Image i, int x, int y, int w, int h, Image i, int x, int y, int w, int h,
int a, int b, int c, int d, Color k, ImageObserver o) int a, int b, int c, int d, Color k, ImageObserver o)
@@ -536,23 +614,27 @@ public class TGraphics2D extends Graphics2D
return _primary.drawImage(i, x, y, w, h, a, b, c, d, k, o); return _primary.drawImage(i, x, y, w, h, a, b, c, d, k, o);
} }
@Override
public void dispose () public void dispose ()
{ {
_copy.dispose(); _copy.dispose();
_primary.dispose(); _primary.dispose();
} }
@Override
public void finalize () public void finalize ()
{ {
_copy.finalize(); _copy.finalize();
_primary.finalize(); _primary.finalize();
} }
@Override
public String toString () public String toString ()
{ {
return _primary.toString(); return _primary.toString();
} }
@Override
@Deprecated @Deprecated
public Rectangle getClipRect () public Rectangle getClipRect ()
{ {
@@ -561,11 +643,13 @@ public class TGraphics2D extends Graphics2D
return _primary.getClipBounds(); return _primary.getClipBounds();
} }
@Override
public boolean hitClip (int x, int y, int w, int h) public boolean hitClip (int x, int y, int w, int h)
{ {
return _primary.hitClip(x, y, w, h); return _primary.hitClip(x, y, w, h);
} }
@Override
public Rectangle getClipBounds (Rectangle r) public Rectangle getClipBounds (Rectangle r)
{ {
return _primary.getClipBounds(r); return _primary.getClipBounds(r);
+14 -8
View File
@@ -20,6 +20,10 @@
package com.samskivert.swing; package com.samskivert.swing;
import javax.swing.table.*;
import javax.swing.event.TableModelListener;
import javax.swing.event.TableModelEvent;
/** /**
* In a chain of data manipulators some behaviour is common. TableMap * In a chain of data manipulators some behaviour is common. TableMap
* provides most of this behavour and can be subclassed by filters * provides most of this behavour and can be subclassed by filters
@@ -30,14 +34,11 @@ package com.samskivert.swing;
* should have no effect. * should have no effect.
* *
* @version 1.4 12/17/97 * @version 1.4 12/17/97
* @author Philip Milne */ * @author Philip Milne
*/
import javax.swing.table.*;
import javax.swing.event.TableModelListener;
import javax.swing.event.TableModelEvent;
public class TableMap extends AbstractTableModel public class TableMap extends AbstractTableModel
implements TableModelListener { implements TableModelListener
{
protected TableModel model; protected TableModel model;
public TableModel getModel() { public TableModel getModel() {
@@ -56,6 +57,7 @@ public class TableMap extends AbstractTableModel
return model.getValueAt(aRow, aColumn); return model.getValueAt(aRow, aColumn);
} }
@Override
public void setValueAt(Object aValue, int aRow, int aColumn) { public void setValueAt(Object aValue, int aRow, int aColumn) {
model.setValueAt(aValue, aRow, aColumn); model.setValueAt(aValue, aRow, aColumn);
} }
@@ -68,17 +70,21 @@ public class TableMap extends AbstractTableModel
return (model == null) ? 0 : model.getColumnCount(); return (model == null) ? 0 : model.getColumnCount();
} }
@Override
public String getColumnName(int aColumn) { public String getColumnName(int aColumn) {
return model.getColumnName(aColumn); return model.getColumnName(aColumn);
} }
@Override
public Class<?> getColumnClass(int aColumn) { public Class<?> getColumnClass(int aColumn) {
return model.getColumnClass(aColumn); return model.getColumnClass(aColumn);
} }
@Override
public boolean isCellEditable(int row, int column) { public boolean isCellEditable(int row, int column) {
return model.isCellEditable(row, column); return model.isCellEditable(row, column);
} }
// //
// Implementation of the TableModelListener interface, // Implementation of the TableModelListener interface,
// //
@@ -281,14 +281,17 @@ public class TableSorter extends AbstractTableModel {
return (tableModel == null) ? 0 : tableModel.getColumnCount(); return (tableModel == null) ? 0 : tableModel.getColumnCount();
} }
@Override
public String getColumnName(int column) { public String getColumnName(int column) {
return tableModel.getColumnName(column); return tableModel.getColumnName(column);
} }
@Override
public Class<?> getColumnClass(int column) { public Class<?> getColumnClass(int column) {
return tableModel.getColumnClass(column); return tableModel.getColumnClass(column);
} }
@Override
public boolean isCellEditable(int row, int column) { public boolean isCellEditable(int row, int column) {
return tableModel.isCellEditable(modelIndex(row), column); return tableModel.isCellEditable(modelIndex(row), column);
} }
@@ -297,6 +300,7 @@ public class TableSorter extends AbstractTableModel {
return tableModel.getValueAt(modelIndex(row), column); return tableModel.getValueAt(modelIndex(row), column);
} }
@Override
public void setValueAt(Object aValue, int row, int column) { public void setValueAt(Object aValue, int row, int column) {
tableModel.setValueAt(aValue, modelIndex(row), column); tableModel.setValueAt(aValue, modelIndex(row), column);
} }
@@ -395,7 +399,7 @@ public class TableSorter extends AbstractTableModel {
} }
private class MouseHandler extends MouseAdapter { private class MouseHandler extends MouseAdapter {
public void mouseClicked(MouseEvent e) { @Override public void mouseClicked(MouseEvent e) {
JTableHeader h = (JTableHeader) e.getSource(); JTableHeader h = (JTableHeader) e.getSource();
TableColumnModel columnModel = h.getColumnModel(); TableColumnModel columnModel = h.getColumnModel();
int viewColumn = columnModel.getColumnIndexAtX(e.getX()); int viewColumn = columnModel.getColumnIndexAtX(e.getX());
+3 -3
View File
@@ -59,7 +59,7 @@ public class Timer extends javax.swing.Timer
} }
} }
// documentation inherited @Override
public String toString () public String toString ()
{ {
return "Timer [source=" + _source + return "Timer [source=" + _source +
@@ -67,7 +67,7 @@ public class Timer extends javax.swing.Timer
"]"; "]";
} }
// documentation inherited @Override
protected void fireActionPerformed (ActionEvent e) protected void fireActionPerformed (ActionEvent e)
{ {
if (_event != null) { if (_event != null) {
@@ -96,7 +96,7 @@ public class Timer extends javax.swing.Timer
* due to the repeating nature: the event could get re-fired * due to the repeating nature: the event could get re-fired
* before your controller has dealt with it. * before your controller has dealt with it.
*/ */
public long getWhen () @Override public long getWhen ()
{ {
return _when; return _when;
} }
@@ -55,6 +55,7 @@ public class VGroupLayout extends GroupLayout
{ {
} }
@Override
protected Dimension getLayoutSize (Container parent, int type) protected Dimension getLayoutSize (Container parent, int type)
{ {
DimenInfo info = computeDimens(parent, type); DimenInfo info = computeDimens(parent, type);
@@ -80,6 +81,7 @@ public class VGroupLayout extends GroupLayout
return dims; return dims;
} }
@Override
public void layoutContainer (Container parent) public void layoutContainer (Container parent)
{ {
Rectangle b = parent.getBounds(); Rectangle b = parent.getBounds();
@@ -369,7 +369,7 @@ public class DnDManager
/** A handy helper that removes components when they're no longer in /** A handy helper that removes components when they're no longer in
* the hierarchy. */ * the hierarchy. */
protected AncestorAdapter _remover = new AncestorAdapter() { protected AncestorAdapter _remover = new AncestorAdapter() {
public void ancestorRemoved (AncestorEvent ae) @Override public void ancestorRemoved (AncestorEvent ae)
{ {
JComponent comp = ae.getComponent(); JComponent comp = ae.getComponent();
// try both.. // try both..
@@ -399,7 +399,7 @@ public class DnDManager
/** Listens to registered drag source components. */ /** Listens to registered drag source components. */
protected MouseInputAdapter _sourceListener = new MouseInputAdapter() { protected MouseInputAdapter _sourceListener = new MouseInputAdapter() {
public void mouseDragged (MouseEvent me) @Override public void mouseDragged (MouseEvent me)
{ {
// make sure a drag hasn't already started. // make sure a drag hasn't already started.
if (isDragging()) { if (isDragging()) {
@@ -442,7 +442,7 @@ public class DnDManager
setComponentCursor(_sourceComp); setComponentCursor(_sourceComp);
} }
public void mouseReleased (MouseEvent event) @Override public void mouseReleased (MouseEvent event)
{ {
if (!isDragging()) { if (!isDragging()) {
return; return;
@@ -463,14 +463,14 @@ public class DnDManager
reset(); reset();
} }
public void mouseExited (MouseEvent event) @Override public void mouseExited (MouseEvent event)
{ {
if (isDragging()) { if (isDragging()) {
clearComponentCursor(); clearComponentCursor();
} }
} }
public void mouseEntered (MouseEvent event) @Override public void mouseEntered (MouseEvent event)
{ {
if (isDragging()) { if (isDragging()) {
setComponentCursor(event.getComponent()); setComponentCursor(event.getComponent());
@@ -480,7 +480,7 @@ public class DnDManager
/** Listens to registered drop targets and their children. */ /** Listens to registered drop targets and their children. */
protected MouseInputAdapter _targetListener = new MouseInputAdapter() { protected MouseInputAdapter _targetListener = new MouseInputAdapter() {
public void mouseEntered (MouseEvent event) @Override public void mouseEntered (MouseEvent event)
{ {
if (!isDragging()) { if (!isDragging()) {
return; return;
@@ -500,7 +500,7 @@ public class DnDManager
setComponentCursor(newcomp); setComponentCursor(newcomp);
} }
public void mouseExited (MouseEvent event) @Override public void mouseExited (MouseEvent event)
{ {
if (!isDragging()) { if (!isDragging()) {
return; return;
@@ -517,7 +517,7 @@ public class DnDManager
checkAutoscroll(event); checkAutoscroll(event);
} }
public void mouseDragged (MouseEvent event) @Override public void mouseDragged (MouseEvent event)
{ {
if (!isDragging()) { if (!isDragging()) {
return; return;
@@ -53,9 +53,7 @@ public class CommandEvent extends ActionEvent
return _argument; return _argument;
} }
/** @Override
* Generates a string representation of this command.
*/
public String toString () public String toString ()
{ {
return "[cmd=" + getActionCommand() + ", src=" + getSource() + return "[cmd=" + getActionCommand() + ", src=" + getSource() +
@@ -49,8 +49,7 @@ public abstract class MouseArmingAdapter
public MouseArmingAdapter (final Component component, final Shape bounds) public MouseArmingAdapter (final Component component, final Shape bounds)
{ {
MouseInputAdapter mia = new MouseInputAdapter() { MouseInputAdapter mia = new MouseInputAdapter() {
// documentation inherited @Override public void mousePressed (MouseEvent e)
public void mousePressed (MouseEvent e)
{ {
if (button1(e) && contains(e)) { if (button1(e) && contains(e)) {
_armed = _startedArmed = true; _armed = _startedArmed = true;
@@ -58,8 +57,7 @@ public abstract class MouseArmingAdapter
} }
} }
// documentation inherited @Override public void mouseReleased (MouseEvent e)
public void mouseReleased (MouseEvent e)
{ {
if (button1(e)) { if (button1(e)) {
if (_armed && contains(e)) { if (_armed && contains(e)) {
@@ -69,8 +67,7 @@ public abstract class MouseArmingAdapter
} }
} }
// documentation inherited @Override public void mouseDragged (MouseEvent e)
public void mouseDragged (MouseEvent e)
{ {
if (_startedArmed && (contains(e) != _armed)) { if (_startedArmed && (contains(e) != _armed)) {
_armed = !_armed; _armed = !_armed;
@@ -85,6 +85,7 @@ public class LabelDemo extends JPanel
} }
} }
@Override
public void doLayout () public void doLayout ()
{ {
super.doLayout(); super.doLayout();
@@ -99,6 +100,7 @@ public class LabelDemo extends JPanel
} }
} }
@Override
public void paintComponent (Graphics g) public void paintComponent (Graphics g)
{ {
super.paintComponent(g); super.paintComponent(g);
@@ -131,6 +133,7 @@ public class LabelDemo extends JPanel
} }
} }
@Override
public Dimension getPreferredSize () public Dimension getPreferredSize ()
{ {
return new Dimension(400, 300); return new Dimension(400, 300);
@@ -36,6 +36,7 @@ public class ProximityTrackerTest extends TestCase
super(ProximityTrackerTest.class.getName()); super(ProximityTrackerTest.class.getName());
} }
@Override
public void runTest () public void runTest ()
{ {
Random rand = new Random(); Random rand = new Random();
@@ -120,7 +120,7 @@ public class MouseHijacker
/** Used to capture each motion event while everything's hijacked. */ /** Used to capture each motion event while everything's hijacked. */
protected MouseMotionListener _motionCatcher = new MouseMotionAdapter() { protected MouseMotionListener _motionCatcher = new MouseMotionAdapter() {
public void mouseMoved (MouseEvent evt) @Override public void mouseMoved (MouseEvent evt)
{ {
_lastMotion = evt; _lastMotion = evt;
} }
@@ -207,9 +207,7 @@ public class ProximityTracker
return _records[minidx].object; return _records[minidx].object;
} }
/** @Override
* Generates a string representation of this instance.
*/
public String toString () public String toString ()
{ {
return "[size=" + _size + return "[size=" + _size +
@@ -276,7 +274,7 @@ public class ProximityTracker
this.object = object; this.object = object;
} }
public String toString () @Override public String toString ()
{ {
return "[x=" + x + ", y=" + y + "]"; // + ", object=" + object + "]"; return "[x=" + x + ", y=" + y + "]"; // + ", object=" + object + "]";
} }
@@ -371,8 +371,7 @@ public class SwingUtil
// set up the filter. // set up the filter.
((AbstractDocument) doc).setDocumentFilter(new DocumentFilter() ((AbstractDocument) doc).setDocumentFilter(new DocumentFilter()
{ {
// documentation inherited @Override public void remove (FilterBypass fb, int offset, int length)
public void remove (FilterBypass fb, int offset, int length)
throws BadLocationException throws BadLocationException
{ {
if (replaceOk(offset, length, "")) { if (replaceOk(offset, length, "")) {
@@ -381,8 +380,7 @@ public class SwingUtil
} }
} }
// documentation inherited @Override public void insertString (
public void insertString (
FilterBypass fb, int offset, String string, AttributeSet attr) FilterBypass fb, int offset, String string, AttributeSet attr)
throws BadLocationException throws BadLocationException
{ {
@@ -392,8 +390,7 @@ public class SwingUtil
} }
} }
// documentation inherited @Override public void replace (
public void replace (
FilterBypass fb, int offset, int length, String text, FilterBypass fb, int offset, int length, String text,
AttributeSet attrs) AttributeSet attrs)
throws BadLocationException throws BadLocationException
@@ -99,7 +99,8 @@ public class TaskMaster
* invoke this runnable so run() is synchronized. Oh how I love * invoke this runnable so run() is synchronized. Oh how I love
* Chapter 17. * Chapter 17.
*/ */
public synchronized void run () @Override
public synchronized void run ()
{ {
switch (_mode) { switch (_mode) {
default: default:
+15 -17
View File
@@ -60,7 +60,7 @@ public class ArrayIntSet extends AbstractSet<Integer>
this(DEFAULT_CAPACITY); this(DEFAULT_CAPACITY);
} }
// documentation inherited from interface @Override
public int size () public int size ()
{ {
return _size; return _size;
@@ -78,13 +78,13 @@ public class ArrayIntSet extends AbstractSet<Integer>
return _values[index]; return _values[index];
} }
// documentation inherited from interface @Override
public boolean isEmpty () public boolean isEmpty ()
{ {
return _size == 0; return _size == 0;
} }
// documentation inherited from interface @Override
public boolean contains (Object o) public boolean contains (Object o)
{ {
return contains(((Integer)o).intValue()); return contains(((Integer)o).intValue());
@@ -132,13 +132,13 @@ public class ArrayIntSet extends AbstractSet<Integer>
}; };
} }
// documentation inherited from interface @Override
public Iterator<Integer> iterator () public Iterator<Integer> iterator ()
{ {
return interator(); return interator();
} }
// documentation inherited from interface @Override
public Object[] toArray () public Object[] toArray ()
{ {
return toArray(new Integer[_size]); return toArray(new Integer[_size]);
@@ -188,7 +188,7 @@ public class ArrayIntSet extends AbstractSet<Integer>
return values; return values;
} }
// documentation inherited from interface @Override
public boolean add (Integer o) public boolean add (Integer o)
{ {
return add(o.intValue()); return add(o.intValue());
@@ -245,7 +245,7 @@ public class ArrayIntSet extends AbstractSet<Integer>
return modified; return modified;
} }
// documentation inherited from interface @Override
public boolean remove (Object o) public boolean remove (Object o)
{ {
return remove(((Integer)o).intValue()); return remove(((Integer)o).intValue());
@@ -294,7 +294,7 @@ public class ArrayIntSet extends AbstractSet<Integer>
return modified; return modified;
} }
// documentation inherited from interface @Override
public boolean containsAll (Collection<?> c) public boolean containsAll (Collection<?> c)
{ {
if (c instanceof Interable) { if (c instanceof Interable) {
@@ -311,7 +311,7 @@ public class ArrayIntSet extends AbstractSet<Integer>
} }
} }
// documentation inherited from interface @Override
public boolean addAll (Collection<? extends Integer> c) public boolean addAll (Collection<? extends Integer> c)
{ {
if (c instanceof Interable) { if (c instanceof Interable) {
@@ -329,7 +329,7 @@ public class ArrayIntSet extends AbstractSet<Integer>
} }
} }
// documentation inherited from interface @Override
public boolean retainAll (Collection<?> c) public boolean retainAll (Collection<?> c)
{ {
if (c instanceof IntSet) { if (c instanceof IntSet) {
@@ -357,14 +357,14 @@ public class ArrayIntSet extends AbstractSet<Integer>
} }
} }
// documentation inherited from interface @Override
public void clear () public void clear ()
{ {
Arrays.fill(_values, 0); Arrays.fill(_values, 0);
_size = 0; _size = 0;
} }
// documentation inherited from interface @Override
public boolean equals (Object o) public boolean equals (Object o)
{ {
if (o instanceof ArrayIntSet) { if (o instanceof ArrayIntSet) {
@@ -384,7 +384,7 @@ public class ArrayIntSet extends AbstractSet<Integer>
return false; return false;
} }
// documentation inherited from interface @Override
public int hashCode () public int hashCode ()
{ {
int hashCode = 0; int hashCode = 0;
@@ -394,7 +394,7 @@ public class ArrayIntSet extends AbstractSet<Integer>
return hashCode; return hashCode;
} }
// documentation inherited from interface @Override
public Object clone () public Object clone ()
{ {
try { try {
@@ -407,9 +407,7 @@ public class ArrayIntSet extends AbstractSet<Integer>
} }
} }
/** @Override
* Returns a string representation of this instance.
*/
public String toString () public String toString ()
{ {
return StringUtil.toString(iterator()); return StringUtil.toString(iterator());
@@ -182,7 +182,7 @@ public class AuditLogger
/** The interval that rolls over the log file. */ /** The interval that rolls over the log file. */
protected Interval _rollover = new Interval() { protected Interval _rollover = new Interval() {
public void expired () { @Override public void expired () {
checkRollOver(); checkRollOver();
} }
}; };
+19 -14
View File
@@ -39,31 +39,32 @@ import static com.samskivert.Log.log;
public abstract class BaseArrayList<E> extends AbstractList<E> public abstract class BaseArrayList<E> extends AbstractList<E>
implements List<E>, RandomAccess, Cloneable, Serializable implements List<E>, RandomAccess, Cloneable, Serializable
{ {
// documentation inherited from interface @Override
public int size () public int size ()
{ {
return _size; return _size;
} }
// documentation inherited from interface @Override
public boolean isEmpty () public boolean isEmpty ()
{ {
return (_size == 0); return (_size == 0);
} }
// documentation inherited from interface @Override
public boolean contains (Object o) public boolean contains (Object o)
{ {
return ListUtil.contains(_elements, o); return ListUtil.contains(_elements, o);
} }
// documentation inherited from interface @Override
public Object[] toArray () public Object[] toArray ()
{ {
return toArray(new Object[_size]); return toArray(new Object[_size]);
} }
@SuppressWarnings("unchecked") // documentation inherited from interface @Override
@SuppressWarnings("unchecked")
public <T> T[] toArray (T[] target) public <T> T[] toArray (T[] target)
{ {
// create the target array if necessary // create the target array if necessary
@@ -80,14 +81,15 @@ public abstract class BaseArrayList<E> extends AbstractList<E>
return target; return target;
} }
// documentation inherited @Override
public void clear () public void clear ()
{ {
_elements = null; _elements = null;
_size = 0; _size = 0;
} }
@SuppressWarnings("unchecked") // documentation inherited from interface @Override
@SuppressWarnings("unchecked")
public boolean add (E o) public boolean add (E o)
{ {
_elements = (E[])ListUtil.add(_elements, _size, o); _elements = (E[])ListUtil.add(_elements, _size, o);
@@ -95,7 +97,7 @@ public abstract class BaseArrayList<E> extends AbstractList<E>
return true; return true;
} }
// documentation inherited from interface @Override
public boolean remove (Object o) public boolean remove (Object o)
{ {
if (ListUtil.remove(_elements, o) != null) { if (ListUtil.remove(_elements, o) != null) {
@@ -105,14 +107,14 @@ public abstract class BaseArrayList<E> extends AbstractList<E>
return false; return false;
} }
// documentation inherited from interface @Override
public E get (int index) public E get (int index)
{ {
rangeCheck(index, false); rangeCheck(index, false);
return _elements[index]; return _elements[index];
} }
// documentation inherited from interface @Override
public E set (int index, E element) public E set (int index, E element)
{ {
rangeCheck(index, false); rangeCheck(index, false);
@@ -121,7 +123,8 @@ public abstract class BaseArrayList<E> extends AbstractList<E>
return old; return old;
} }
@SuppressWarnings("unchecked") // documentation inherited from interface @Override
@SuppressWarnings("unchecked")
public void add (int index, E element) public void add (int index, E element)
{ {
rangeCheck(index, true); rangeCheck(index, true);
@@ -129,7 +132,8 @@ public abstract class BaseArrayList<E> extends AbstractList<E>
_size++; _size++;
} }
@SuppressWarnings("unchecked") // documentation inherited from interface @Override
@SuppressWarnings("unchecked")
public E remove (int index) public E remove (int index)
{ {
rangeCheck(index, false); rangeCheck(index, false);
@@ -138,7 +142,7 @@ public abstract class BaseArrayList<E> extends AbstractList<E>
return oval; return oval;
} }
// documentation inherited from interface @Override
public int indexOf (Object o) public int indexOf (Object o)
{ {
return ListUtil.indexOf(_elements, o); return ListUtil.indexOf(_elements, o);
@@ -162,7 +166,8 @@ public abstract class BaseArrayList<E> extends AbstractList<E>
} }
} }
@SuppressWarnings("unchecked") // documentation inherited @Override
@SuppressWarnings("unchecked")
public Object clone () public Object clone ()
{ {
try { try {
@@ -49,7 +49,7 @@ public class BasicRunQueue extends LoopingThread
return Thread.currentThread() == this; return Thread.currentThread() == this;
} }
// documentation inherited @Override
protected void iterate () protected void iterate ()
{ {
Runnable r = _queue.get(); Runnable r = _queue.get();
@@ -61,7 +61,7 @@ public class BasicRunQueue extends LoopingThread
} }
} }
// documentation inherited @Override
protected void kick () protected void kick ()
{ {
postRunnable(new Runnable() { postRunnable(new Runnable() {
+12 -6
View File
@@ -346,15 +346,18 @@ public class Collections
} }
} }
public boolean equals(Object o) { @Override
public boolean equals(Object o) {
synchronized(mutex) {return m.equals(o);} synchronized(mutex) {return m.equals(o);}
} }
public int hashCode() { @Override
public int hashCode() {
synchronized(mutex) {return m.hashCode();} synchronized(mutex) {return m.hashCode();}
} }
public String toString() { @Override
public String toString() {
synchronized(mutex) {return m.toString();} synchronized(mutex) {return m.toString();}
} }
} }
@@ -374,10 +377,12 @@ public class Collections
super(s, mutex); super(s, mutex);
} }
public boolean equals(Object o) { @Override
public boolean equals(Object o) {
synchronized(mutex) {return c.equals(o);} synchronized(mutex) {return c.equals(o);}
} }
public int hashCode() { @Override
public int hashCode() {
synchronized(mutex) {return c.hashCode();} synchronized(mutex) {return c.hashCode();}
} }
} }
@@ -484,7 +489,8 @@ public class Collections
public void clear() { public void clear() {
synchronized(mutex) {c.clear();} synchronized(mutex) {c.clear();}
} }
public String toString() { @Override
public String toString() {
synchronized(mutex) {return c.toString();} synchronized(mutex) {return c.toString();}
} }
} }
+2 -2
View File
@@ -654,12 +654,12 @@ public class ConfigUtil
} }
} }
public boolean equals (Object other) @Override public boolean equals (Object other)
{ {
return _package.equals(((PropRecord)other)._package); return _package.equals(((PropRecord)other)._package);
} }
public String toString () @Override public String toString ()
{ {
return "[package=" + _package + return "[package=" + _package +
", overrides=" + StringUtil.toString(_overrides) + ", overrides=" + StringUtil.toString(_overrides) +
+11 -10
View File
@@ -108,8 +108,8 @@ public class CountHashMap<K> extends HashMap<K, int[]>
public int getTotalCount () public int getTotalCount ()
{ {
int count = 0; int count = 0;
for (Iterator<int[]> itr = values().iterator(); itr.hasNext(); ) { for (int[] name : values()) {
count += itr.next()[0]; count += name[0];
} }
return count; return count;
} }
@@ -126,7 +126,8 @@ public class CountHashMap<K> extends HashMap<K, int[]>
} }
} }
@SuppressWarnings("unchecked") // documentation inherited @Override
@SuppressWarnings("unchecked")
public Set<Map.Entry<K, int[]>> entrySet () public Set<Map.Entry<K, int[]>> entrySet ()
{ {
// a giant mess of hoop-jumpery so that we can convert each Map.Entry // a giant mess of hoop-jumpery so that we can convert each Map.Entry
@@ -150,7 +151,7 @@ public class CountHashMap<K> extends HashMap<K, int[]>
_entry = entry; _entry = entry;
} }
public boolean equals (Object o) @Override public boolean equals (Object o)
{ {
return _entry.equals(o); return _entry.equals(o);
} }
@@ -165,7 +166,7 @@ public class CountHashMap<K> extends HashMap<K, int[]>
return _entry.getValue(); return _entry.getValue();
} }
public int hashCode () @Override public int hashCode ()
{ {
return _entry.hashCode(); return _entry.hashCode();
} }
@@ -199,7 +200,7 @@ public class CountHashMap<K> extends HashMap<K, int[]>
_superset = superset; _superset = superset;
} }
public Iterator<Entry<E>> iterator () @Override public Iterator<Entry<E>> iterator ()
{ {
final Iterator<Map.Entry<E, int[]>> itr = _superset.iterator(); final Iterator<Map.Entry<E, int[]>> itr = _superset.iterator();
return new Iterator<Entry<E>>() { return new Iterator<Entry<E>>() {
@@ -220,22 +221,22 @@ public class CountHashMap<K> extends HashMap<K, int[]>
}; };
} }
public boolean contains (Object o) @Override public boolean contains (Object o)
{ {
return _superset.contains(o); return _superset.contains(o);
} }
public boolean remove (Object o) @Override public boolean remove (Object o)
{ {
return _superset.remove(o); return _superset.remove(o);
} }
public int size () @Override public int size ()
{ {
return CountHashMap.this.size(); return CountHashMap.this.size();
} }
public void clear () @Override public void clear ()
{ {
CountHashMap.this.clear(); CountHashMap.this.clear();
} }
+21 -21
View File
@@ -75,13 +75,13 @@ public class HashIntMap<V> extends AbstractMap<Integer,V>
this(DEFAULT_BUCKETS, DEFAULT_LOAD_FACTOR); this(DEFAULT_BUCKETS, DEFAULT_LOAD_FACTOR);
} }
// documentation inherited @Override
public int size () public int size ()
{ {
return _size; return _size;
} }
// documentation inherited @Override
public boolean containsKey (Object key) public boolean containsKey (Object key)
{ {
return containsKey(((Integer)key).intValue()); return containsKey(((Integer)key).intValue());
@@ -93,7 +93,7 @@ public class HashIntMap<V> extends AbstractMap<Integer,V>
return get(key) != null; return get(key) != null;
} }
// documentation inherited @Override
public boolean containsValue (Object o) public boolean containsValue (Object o)
{ {
for (int ii = 0, ll = _buckets.length; ii < ll; ii++) { for (int ii = 0, ll = _buckets.length; ii < ll; ii++) {
@@ -106,7 +106,7 @@ public class HashIntMap<V> extends AbstractMap<Integer,V>
return false; return false;
} }
// documentation inherited @Override
public V get (Object key) public V get (Object key)
{ {
return get(((Integer)key).intValue()); return get(((Integer)key).intValue());
@@ -124,7 +124,7 @@ public class HashIntMap<V> extends AbstractMap<Integer,V>
return null; return null;
} }
// documentation inherited @Override
public V put (Integer key, V value) public V put (Integer key, V value)
{ {
return put(key.intValue(), value); return put(key.intValue(), value);
@@ -163,7 +163,7 @@ public class HashIntMap<V> extends AbstractMap<Integer,V>
return null; return null;
} }
// documentation inherited @Override
public V remove (Object key) public V remove (Object key)
{ {
return remove(((Integer)key).intValue()); return remove(((Integer)key).intValue());
@@ -213,7 +213,7 @@ public class HashIntMap<V> extends AbstractMap<Integer,V>
} }
} }
// documentation inherited @Override
public void clear () public void clear ()
{ {
// abandon all of our hash chains (the joy of garbage collection) // abandon all of our hash chains (the joy of garbage collection)
@@ -291,14 +291,14 @@ public class HashIntMap<V> extends AbstractMap<Integer,V>
} }
} }
// documentation inherited @Override
public Set<Entry<Integer,V>> entrySet () public Set<Entry<Integer,V>> entrySet ()
{ {
return new AbstractSet<Entry<Integer,V>>() { return new AbstractSet<Entry<Integer,V>>() {
public int size () { @Override public int size () {
return _size; return _size;
} }
public Iterator<Entry<Integer,V>> iterator () { @Override public Iterator<Entry<Integer,V>> iterator () {
return new MapEntryIterator(); return new MapEntryIterator();
} }
}; };
@@ -308,10 +308,10 @@ public class HashIntMap<V> extends AbstractMap<Integer,V>
public Set<IntEntry<V>> intEntrySet () public Set<IntEntry<V>> intEntrySet ()
{ {
return new AbstractSet<IntEntry<V>>() { return new AbstractSet<IntEntry<V>>() {
public int size () { @Override public int size () {
return _size; return _size;
} }
public Iterator<IntEntry<V>> iterator () { @Override public Iterator<IntEntry<V>> iterator () {
return new IntEntryIterator(); return new IntEntryIterator();
} }
}; };
@@ -394,7 +394,7 @@ public class HashIntMap<V> extends AbstractMap<Integer,V>
protected class IntKeySet extends AbstractSet<Integer> protected class IntKeySet extends AbstractSet<Integer>
implements IntSet implements IntSet
{ {
public Iterator<Integer> iterator () { @Override public Iterator<Integer> iterator () {
return interator(); return interator();
} }
@@ -416,11 +416,11 @@ public class HashIntMap<V> extends AbstractMap<Integer,V>
}; };
} }
public int size () { @Override public int size () {
return HashIntMap.this.size(); return HashIntMap.this.size();
} }
public boolean contains (Object t) { @Override public boolean contains (Object t) {
return HashIntMap.this.containsKey(t); return HashIntMap.this.containsKey(t);
} }
@@ -432,7 +432,7 @@ public class HashIntMap<V> extends AbstractMap<Integer,V>
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
public boolean remove (Object o) { @Override public boolean remove (Object o) {
return (null != HashIntMap.this.remove(o)); return (null != HashIntMap.this.remove(o));
} }
@@ -461,7 +461,7 @@ public class HashIntMap<V> extends AbstractMap<Integer,V>
return _keySet; return _keySet;
} }
// documentation inherited @Override
public Set<Integer> keySet () public Set<Integer> keySet ()
{ {
return intKeySet(); return intKeySet();
@@ -484,7 +484,7 @@ public class HashIntMap<V> extends AbstractMap<Integer,V>
return values().iterator(); return values().iterator();
} }
// documentation inherited from interface cloneable @Override
public Object clone () public Object clone ()
{ {
HashIntMap<V> copy = new HashIntMap<V>(_buckets.length, _loadFactor); HashIntMap<V> copy = new HashIntMap<V>(_buckets.length, _loadFactor);
@@ -576,7 +576,7 @@ public class HashIntMap<V> extends AbstractMap<Integer,V>
return ovalue; return ovalue;
} }
public boolean equals (Object o) @Override public boolean equals (Object o)
{ {
if (!(o instanceof IntEntry)) { if (!(o instanceof IntEntry)) {
return false; return false;
@@ -586,12 +586,12 @@ public class HashIntMap<V> extends AbstractMap<Integer,V>
ObjectUtil.equals(this.value, that.getValue()); ObjectUtil.equals(this.value, that.getValue());
} }
public int hashCode () @Override public int hashCode ()
{ {
return key ^ ((value == null) ? 0 : value.hashCode()); return key ^ ((value == null) ? 0 : value.hashCode());
} }
public String toString () @Override public String toString ()
{ {
return key + "=" + StringUtil.toString(value); return key + "=" + StringUtil.toString(value);
} }
+1 -3
View File
@@ -101,9 +101,7 @@ public class Histogram
return buf.toString(); return buf.toString();
} }
/** @Override
* Returns a string representation of this histogram.
*/
public String toString () public String toString ()
{ {
return "[min=" + _minValue + ", max=" + _maxValue + return "[min=" + _minValue + ", max=" + _maxValue +
+5 -7
View File
@@ -280,9 +280,7 @@ public class IntIntMap
return toIntArray(false); return toIntArray(false);
} }
/** @Override
* Returns a string representation of this instance.
*/
public String toString () public String toString ()
{ {
StringBuilder buf = new StringBuilder("["); StringBuilder buf = new StringBuilder("[");
@@ -317,11 +315,11 @@ public class IntIntMap
public Set<IntIntEntry> entrySet () public Set<IntIntEntry> entrySet ()
{ {
return new AbstractSet<IntIntEntry>() { return new AbstractSet<IntIntEntry>() {
public int size () { @Override public int size () {
return _size; return _size;
} }
public Iterator<IntIntEntry> iterator() { @Override public Iterator<IntIntEntry> iterator() {
return new IntEntryIterator(); return new IntEntryIterator();
} }
}; };
@@ -405,7 +403,7 @@ public class IntIntMap
return oldVal; return oldVal;
} }
public boolean equals (Object o) { @Override public boolean equals (Object o) {
if (o instanceof IntIntEntry) { if (o instanceof IntIntEntry) {
IntIntEntry that = (IntIntEntry) o; IntIntEntry that = (IntIntEntry) o;
return (this.key == that.getIntKey()) && return (this.key == that.getIntKey()) &&
@@ -414,7 +412,7 @@ public class IntIntMap
return false; return false;
} }
public int hashCode () { @Override public int hashCode () {
return key; return key;
} }
} }
@@ -49,6 +49,7 @@ public class IntTuple
/** /**
* Returns the combined hashcode of the two elements. * Returns the combined hashcode of the two elements.
*/ */
@Override
public int hashCode () public int hashCode ()
{ {
return left ^ right; return left ^ right;
@@ -65,6 +66,7 @@ public class IntTuple
* are equal to the left and right elements (respectively) of the * are equal to the left and right elements (respectively) of the
* other tuple. * other tuple.
*/ */
@Override
public boolean equals (Object other) public boolean equals (Object other)
{ {
if (other instanceof IntTuple) { if (other instanceof IntTuple) {
@@ -75,6 +77,7 @@ public class IntTuple
} }
} }
@Override
public String toString () public String toString ()
{ {
return "[left=" + left + ", right=" + right + "]"; return "[left=" + left + ", right=" + right + "]";
+3 -5
View File
@@ -222,8 +222,7 @@ public abstract class Interval
_interval = interval; _interval = interval;
} }
@Override @Override public boolean cancel ()
public boolean cancel ()
{ {
// remove the reference back to the interval, allowing the Interval itself // remove the reference back to the interval, allowing the Interval itself
// to be gc'd even as this Task potentially sits on the Timer queue. // to be gc'd even as this Task potentially sits on the Timer queue.
@@ -231,8 +230,7 @@ public abstract class Interval
return super.cancel(); return super.cancel();
} }
// documentation inherited @Override public void run () {
public void run () {
Interval ival = _interval; Interval ival = _interval;
if (ival == null) { if (ival == null) {
return; return;
@@ -254,7 +252,7 @@ public abstract class Interval
return _interval; return _interval;
} }
public String toString () { @Override public String toString () {
Interval ival = _interval; Interval ival = _interval;
return (ival != null) ? ival.toString() : "(Interval was cancelled)"; return (ival != null) ? ival.toString() : "(Interval was cancelled)";
} }
+7 -6
View File
@@ -104,7 +104,7 @@ public class Invoker extends LoopingThread
} }
/** Returns the name of this invoker. */ /** Returns the name of this invoker. */
public String toString () @Override public String toString ()
{ {
return _name; return _name;
} }
@@ -148,12 +148,12 @@ public class Invoker extends LoopingThread
public void postRunnable (final Runnable r) public void postRunnable (final Runnable r)
{ {
postUnit(new Unit() { postUnit(new Unit() {
public boolean invoke () { @Override public boolean invoke () {
r.run(); r.run();
return false; return false;
} }
public String toString () { @Override public String toString () {
return "Posted Runnable: " + String.valueOf(r); return "Posted Runnable: " + String.valueOf(r);
} }
}); });
@@ -165,7 +165,7 @@ public class Invoker extends LoopingThread
return (this == Thread.currentThread()); return (this == Thread.currentThread());
} }
// documentation inherited @Override
public void iterate () public void iterate ()
{ {
// pop the next item off of the queue // pop the next item off of the queue
@@ -199,10 +199,11 @@ public class Invoker extends LoopingThread
* Shuts down the invoker thread by queueing up a unit that will cause the thread to exit after * Shuts down the invoker thread by queueing up a unit that will cause the thread to exit after
* all currently queued units are processed. * all currently queued units are processed.
*/ */
@Override
public void shutdown () public void shutdown ()
{ {
_queue.append(new Unit() { _queue.append(new Unit() {
public boolean invoke () { @Override public boolean invoke () {
_running = false; _running = false;
return false; return false;
} }
@@ -266,7 +267,7 @@ public class Invoker extends LoopingThread
_histo.clear(); _histo.clear();
} }
public String toString () { @Override public String toString () {
int count = _histo.size(); int count = _histo.size();
return _totalElapsed + "ms/" + count + " = " + (_totalElapsed/count) + "ms avg " + return _totalElapsed + "ms/" + count + " = " + (_totalElapsed/count) + "ms avg " +
StringUtil.toString(_histo.getBuckets()); StringUtil.toString(_histo.getBuckets());
+3 -4
View File
@@ -56,21 +56,20 @@ public class KeyValue<K extends Comparable<? super K>,V>
this.value = value; this.value = value;
} }
/** @Override
* Generates a string representation of this instance.
*/
public String toString () public String toString ()
{ {
return key + "=" + value; return key + "=" + value;
} }
@Override
@SuppressWarnings("unchecked") // documentation inherited @SuppressWarnings("unchecked") // documentation inherited
public boolean equals (Object other) public boolean equals (Object other)
{ {
return key.equals(((KeyValue<K,V>)other).key); return key.equals(((KeyValue<K,V>)other).key);
} }
// documentation inherited @Override
public int hashCode () public int hashCode ()
{ {
return key.hashCode(); return key.hashCode();
+4 -3
View File
@@ -122,7 +122,8 @@ public class LRUHashMap<K,V> implements Map<K,V>
*/ */
public void setCanFlush (boolean canFlush) public void setCanFlush (boolean canFlush)
{ {
if (_canFlush = canFlush) { _canFlush = canFlush;
if (_canFlush) {
// if we just reenabled flushing, flush // if we just reenabled flushing, flush
flush(); flush();
} }
@@ -327,13 +328,13 @@ public class LRUHashMap<K,V> implements Map<K,V>
return Collections.unmodifiableSet(_delegate.entrySet()); return Collections.unmodifiableSet(_delegate.entrySet());
} }
// documentation inherited from interface @Override
public boolean equals (Object o) public boolean equals (Object o)
{ {
return _delegate.equals(o); return _delegate.equals(o);
} }
// documentation inherited from interface @Override
public int hashCode () public int hashCode ()
{ {
return _delegate.hashCode(); return _delegate.hashCode();
@@ -66,6 +66,7 @@ public class LoopingThread extends Thread
* #iterate} to perform whatever action needs to be performed inside * #iterate} to perform whatever action needs to be performed inside
* the loop. * the loop.
*/ */
@Override
public void run () public void run ()
{ {
try { try {
@@ -64,6 +64,7 @@ public class MethodFinder
_clazz = clazz; _clazz = clazz;
} }
@Override
public boolean equals (Object o) public boolean equals (Object o)
{ {
if (this == o) { if (this == o) {
@@ -57,7 +57,7 @@ public class OneLineLogFormatter extends Formatter
_showWhere = showWhere; _showWhere = showWhere;
} }
// documentation inherited @Override
public String format (LogRecord record) public String format (LogRecord record)
{ {
StringBuffer buf = new StringBuffer(); StringBuffer buf = new StringBuffer();
+9 -18
View File
@@ -58,8 +58,7 @@ public abstract class Predicate<T>
_class = clazz; _class = clazz;
} }
// from Predicate @Override public boolean isMatch (T obj)
public boolean isMatch (T obj)
{ {
return _class.isInstance(obj); return _class.isInstance(obj);
} }
@@ -82,8 +81,7 @@ public abstract class Predicate<T>
_preds = preds; _preds = preds;
} }
// from Predicate @Override public boolean isMatch (T obj)
public boolean isMatch (T obj)
{ {
for (Predicate<T> pred : _preds) { for (Predicate<T> pred : _preds) {
if (!pred.isMatch(obj)) { if (!pred.isMatch(obj)) {
@@ -111,8 +109,7 @@ public abstract class Predicate<T>
_preds = preds; _preds = preds;
} }
// from Predicate @Override public boolean isMatch (T obj)
public boolean isMatch (T obj)
{ {
for (Predicate<T> pred : _preds) { for (Predicate<T> pred : _preds) {
if (pred.isMatch(obj)) { if (pred.isMatch(obj)) {
@@ -135,8 +132,7 @@ public abstract class Predicate<T>
_pred = negated; _pred = negated;
} }
// from Predicate @Override public boolean isMatch (T obj)
public boolean isMatch (T obj)
{ {
return !_pred.isMatch(obj); return !_pred.isMatch(obj);
} }
@@ -255,8 +251,7 @@ public abstract class Predicate<T>
{ {
// TODO: create a collection of the same type? // TODO: create a collection of the same type?
return new AbstractCollection<E>() { return new AbstractCollection<E>() {
// from abstract AbstractCollection @Override public int size ()
public int size ()
{ {
// oh god, oh god: we iterate and count // oh god, oh god: we iterate and count
int size = 0; int size = 0;
@@ -266,20 +261,17 @@ public abstract class Predicate<T>
return size; return size;
} }
@Override @Override public boolean add (E element)
public boolean add (E element)
{ {
return input.add(element); return input.add(element);
} }
@Override @Override public boolean remove (Object element)
public boolean remove (Object element)
{ {
return input.remove(element); return input.remove(element);
} }
@Override @Override public boolean contains (Object element)
public boolean contains (Object element)
{ {
try { try {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@@ -292,8 +284,7 @@ public abstract class Predicate<T>
} }
} }
// from abstract AbstractCollection @Override public Iterator<E> iterator ()
public Iterator<E> iterator ()
{ {
return filter(input.iterator()); return filter(input.iterator());
} }
@@ -290,27 +290,27 @@ public class PrefsConfig extends Config
public NullPreferences () { public NullPreferences () {
super(null, ""); super(null, "");
} }
protected void putSpi (String key, String value) { @Override protected void putSpi (String key, String value) {
} }
protected String getSpi (String key) { @Override protected String getSpi (String key) {
return null; return null;
} }
protected void removeSpi (String key) { @Override protected void removeSpi (String key) {
} }
protected void removeNodeSpi () throws BackingStoreException { @Override protected void removeNodeSpi () throws BackingStoreException {
} }
protected String[] keysSpi () throws BackingStoreException { @Override protected String[] keysSpi () throws BackingStoreException {
return new String[0]; return new String[0];
} }
protected String[] childrenNamesSpi () throws BackingStoreException { @Override protected String[] childrenNamesSpi () throws BackingStoreException {
return new String[0]; return new String[0];
} }
protected AbstractPreferences childSpi (String name) { @Override protected AbstractPreferences childSpi (String name) {
return null; return null;
} }
protected void syncSpi () throws BackingStoreException { @Override protected void syncSpi () throws BackingStoreException {
} }
protected void flushSpi () throws BackingStoreException { @Override protected void flushSpi () throws BackingStoreException {
} }
} }
@@ -70,7 +70,7 @@ public class ProcessLogger
_reader = new BufferedReader(new InputStreamReader(input)); _reader = new BufferedReader(new InputStreamReader(input));
} }
public void run () @Override public void run ()
{ {
String line; String line;
try { try {
@@ -114,14 +114,14 @@ public class PropertiesUtil
{ {
final String dprefix = prefix + "."; final String dprefix = prefix + ".";
return new Properties() { return new Properties() {
public String getProperty (String key) { @Override public String getProperty (String key) {
return getProperty(key, null); return getProperty(key, null);
} }
public String getProperty (String key, String defaultValue) { @Override public String getProperty (String key, String defaultValue) {
return source.getProperty(dprefix + key, return source.getProperty(dprefix + key,
source.getProperty(key, defaultValue)); source.getProperty(key, defaultValue));
} }
public Enumeration<?> propertyNames () { @Override public Enumeration<?> propertyNames () {
return new Enumeration<Object>() { return new Enumeration<Object>() {
public boolean hasMoreElements () { public boolean hasMoreElements () {
return next != null; return next != null;
+1
View File
@@ -243,6 +243,7 @@ public class Queue<T>
return (T[])new Object[size]; return (T[])new Object[size];
} }
@Override
public String toString () public String toString ()
{ {
StringBuilder buf = new StringBuilder(); StringBuilder buf = new StringBuilder();
@@ -129,7 +129,7 @@ public class SerialExecutor
// start up a timer that will abort this thread after the specified // start up a timer that will abort this thread after the specified
// timeout // timeout
new Interval() { new Interval() {
public void expired () { @Override public void expired () {
// this will NOOP if the task has already completed // this will NOOP if the task has already completed
thread.abort(); thread.abort();
} }
@@ -174,7 +174,7 @@ public class SerialExecutor
} }
} }
public void run () @Override public void run ()
{ {
final ExecutorTask task = _task; final ExecutorTask task = _task;
try { try {
+1 -3
View File
@@ -173,9 +173,7 @@ public class SystemInfo
srate + ", " + sfull; srate + ", " + sfull;
} }
/** @Override
* Returns a string representation of this instance.
*/
public String toString () public String toString ()
{ {
StringBuilder buf = new StringBuilder(); StringBuilder buf = new StringBuilder();
+3 -3
View File
@@ -58,6 +58,7 @@ public class Tuple<L,R> implements Serializable
/** /**
* Returns the combined hashcode of the two elements. * Returns the combined hashcode of the two elements.
*/ */
@Override
public int hashCode () public int hashCode ()
{ {
return left.hashCode() ^ right.hashCode(); return left.hashCode() ^ right.hashCode();
@@ -68,6 +69,7 @@ public class Tuple<L,R> implements Serializable
* are equal to the left and right elements (respectively) of the * are equal to the left and right elements (respectively) of the
* other tuple. * other tuple.
*/ */
@Override
public boolean equals (Object other) public boolean equals (Object other)
{ {
if (other instanceof Tuple) { if (other instanceof Tuple) {
@@ -78,9 +80,7 @@ public class Tuple<L,R> implements Serializable
} }
} }
/** @Override
* Generates a string representation of this tuple.
*/
public String toString () public String toString ()
{ {
return "[left=" + left + ", right=" + right + "]"; return "[left=" + left + ", right=" + right + "]";
@@ -35,6 +35,7 @@ public class ArrayIntSetTest extends TestCase
super(ArrayIntSetTest.class.getName()); super(ArrayIntSetTest.class.getName());
} }
@Override
public void runTest () public void runTest ()
{ {
ArrayIntSet set = new ArrayIntSet(); ArrayIntSet set = new ArrayIntSet();
@@ -38,6 +38,7 @@ public class ArrayUtilTest extends TestCase
super(ArrayUtilTest.class.getName()); super(ArrayUtilTest.class.getName());
} }
@Override
public void runTest () public void runTest ()
{ {
// test reversing an array // test reversing an array
@@ -35,6 +35,7 @@ public class CheapIntMapTest extends TestCase
super(CheapIntMapTest.class.getName()); super(CheapIntMapTest.class.getName());
} }
@Override
public void runTest () public void runTest ()
{ {
CheapIntMap map = new CheapIntMap(10); CheapIntMap map = new CheapIntMap(10);
@@ -41,6 +41,7 @@ public class CollectionUtilTest extends TestCase
super(CollectionUtil.class.getName()); super(CollectionUtil.class.getName());
} }
@Override
public void runTest () public void runTest ()
{ {
ArrayList<Integer> list = new ArrayList<Integer>(); ArrayList<Integer> list = new ArrayList<Integer>();
@@ -39,6 +39,7 @@ public class ConfigTest extends TestCase
super(ConfigTest.class.getName()); super(ConfigTest.class.getName());
} }
@Override
public void runTest () public void runTest ()
{ {
PrefsConfig config = new PrefsConfig("rsrc/util/test"); PrefsConfig config = new PrefsConfig("rsrc/util/test");
@@ -73,6 +73,7 @@ public class ConfigUtilTest extends TestCase
super(ConfigUtilTest.class.getName()); super(ConfigUtilTest.class.getName());
} }
@Override
public void runTest () public void runTest ()
{ {
try { try {
@@ -37,6 +37,7 @@ public class HashIntMapTest extends TestCase
super(HashIntMapTest.class.getName()); super(HashIntMapTest.class.getName());
} }
@Override
public void runTest () public void runTest ()
{ {
HashIntMap<Integer> table = new HashIntMap<Integer>(); HashIntMap<Integer> table = new HashIntMap<Integer>();
@@ -34,6 +34,7 @@ public class IntListUtilTest extends TestCase
super(IntListUtilTest.class.getName()); super(IntListUtilTest.class.getName());
} }
@Override
public void runTest () public void runTest ()
{ {
int[] list = null; int[] list = null;
@@ -35,6 +35,7 @@ public class LRUHashMapTest extends TestCase
super(LRUHashMapTest.class.getName()); super(LRUHashMapTest.class.getName());
} }
@Override
public void runTest () public void runTest ()
{ {
LRUHashMap<String,Integer> map = LRUHashMap<String,Integer> map =
@@ -35,6 +35,7 @@ public class ObserverListTest extends TestCase
super(ObserverListTest.class.getName()); super(ObserverListTest.class.getName());
} }
@Override
public void runTest () public void runTest ()
{ {
// Log.info("Testing safe list."); // Log.info("Testing safe list.");
@@ -110,7 +111,7 @@ public class ObserverListTest extends TestCase
// Log.info("foozle! " + _index); // Log.info("foozle! " + _index);
} }
public String toString () @Override public String toString ()
{ {
return Integer.toString(_index); return Integer.toString(_index);
} }
@@ -37,6 +37,7 @@ public class QuickSortTest extends TestCase
super(QuickSortTest.class.getName()); super(QuickSortTest.class.getName());
} }
@Override
public void runTest () public void runTest ()
{ {
Integer[] a = new Integer[100]; Integer[] a = new Integer[100];
@@ -39,6 +39,7 @@ public class SerialExecutorTest extends TestCase
_main = Thread.currentThread(); _main = Thread.currentThread();
} }
@Override
public void runTest () public void runTest ()
{ {
SerialExecutor executor = new SerialExecutor(this); SerialExecutor executor = new SerialExecutor(this);

Some files were not shown because too many files have changed in this diff Show More