diff options
Diffstat (limited to 'EssentialsUpdate/src/f00f/net/irc/martyr/GenericAutoService.java')
-rw-r--r-- | EssentialsUpdate/src/f00f/net/irc/martyr/GenericAutoService.java | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/GenericAutoService.java b/EssentialsUpdate/src/f00f/net/irc/martyr/GenericAutoService.java deleted file mode 100644 index 0b3546231..000000000 --- a/EssentialsUpdate/src/f00f/net/irc/martyr/GenericAutoService.java +++ /dev/null @@ -1,54 +0,0 @@ -package f00f.net.irc.martyr; - -import java.util.Observable; - -/** - * Provides a framework for an auto service. Does enable by default. - * Splits the 'update' method into two, 'updateState' and 'updateCommand'. - * Also provides thread safety on all methods. - */ -public abstract class GenericAutoService extends GenericCommandAutoService -{ - -protected GenericAutoService( IRCConnection connection ) -{ - super( connection ); -} - -public synchronized void enable() -{ - if( enabled ) - return; - - connection.addStateObserver( this ); - - super.enable(); -} - -public synchronized void disable() -{ - if( !enabled ) - return; - - connection.removeStateObserver( this ); - - super.disable(); -} - -public synchronized void update( Observable observer, Object updated ) -{ - if( !enabled ) - throw new IllegalStateException("This observer is not enabled." ); - if( updated instanceof State ) - updateState( (State)updated ); - else - super.update( observer, updated ); -} - -protected abstract void updateState( State state ); - -} - - - - |