From f2745aadc7d0eb02002f667cd72d8536e4f1daf1 Mon Sep 17 00:00:00 2001 From: "David A. Madore" Date: Thu, 22 Apr 2010 02:16:29 +0200 Subject: Various "stylistic" improvements suggested by Joshua Bloch's book. Use @Override annotation. Limit accessibility of fields. Make final what can be. Use complex enums. Don't ignore exceptions. Some more changes on exceptions thrown. --- org/madore/damlengine/TodoItem.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'org/madore/damlengine/TodoItem.java') diff --git a/org/madore/damlengine/TodoItem.java b/org/madore/damlengine/TodoItem.java index 2c4bfd9..078713c 100644 --- a/org/madore/damlengine/TodoItem.java +++ b/org/madore/damlengine/TodoItem.java @@ -2,15 +2,25 @@ package org.madore.damlengine; public abstract class TodoItem { - public TodoDeque ownerDeque; - public Context ctx; - public TodoItem caller; + protected TodoDeque ownerDeque; + protected final Context ctx; + protected final TodoItem caller; public TodoItem(Context ctx, TodoItem caller) { this.ctx = ctx; this.caller = caller; } + public final TodoDeque getOwnerDeque() { + return this.ownerDeque; + } + + public final void setOwnerDeque(TodoDeque ownerDeque) { + if ( this.ownerDeque != null ) + throw new IllegalStateException("item already owned by a deque"); + this.ownerDeque = ownerDeque; + } + public abstract void handle(); } -- cgit v1.2.3