Ranides Atterwim 10 lat temu
rodzic
commit
09c99e3b5f

+ 25 - 50
assira/src/main/java/net/ranides/assira/events/Events.java

@@ -17,47 +17,40 @@ public final class Events {
     }
     }
 
 
     public static Dispose dispose(EventRouter source) {
     public static Dispose dispose(EventRouter source) {
-        return new CDispose(source);
+        return new Dispose(source);
     }
     }
 
 
     public static Stop stop(EventRouter source) {
     public static Stop stop(EventRouter source) {
-        return new CStop(source);
+        return new Stop(source);
     }
     }
 
 
     public static Shutdown shutdown(EventRouter source) {
     public static Shutdown shutdown(EventRouter source) {
-        return new CShutdown(source);
+        return new Shutdown(source);
     }
     }
 
 
     public static Interrupt interrupt(EventRouter source) {
     public static Interrupt interrupt(EventRouter source) {
-        return new CInterrupt(source);
+        return new Interrupt(source);
     }
     }
 
 
     public static Failure failure(Throwable cause) {
     public static Failure failure(Throwable cause) {
-        return new CFailure(cause);
-    }
-    
-    public interface Dispose extends Event {
-        
-        EventRouter router();
-        
+        return new Failure(cause);
     }
     }
 
 
-    private static class CDispose implements Dispose {
+    public static class Dispose implements Event {
         
         
-        private final EventRouter router;
+        protected final EventRouter router;
 
 
-        public CDispose(EventRouter router) {
+        protected Dispose(EventRouter router) {
             this.router = router;
             this.router = router;
         }
         }
         
         
-        @Override
-        public EventRouter router() {
+        public final EventRouter router() {
             return router;
             return router;
         }
         }
         
         
         @Override
         @Override
         public String toString() {
         public String toString() {
-            return "CoreEvent:Dispose<" + router() + ">";
+            return "CoreEvent:Dispose<" + router + ">";
         }
         }
         
         
     }
     }
@@ -68,17 +61,15 @@ public final class Events {
      * Router kończy działanie tylko jeśli jako źródło podany jest referencja do
      * Router kończy działanie tylko jeśli jako źródło podany jest referencja do
      * routera.
      * routera.
      */
      */
-    public interface Stop extends Dispose { }
-    
-    private static class CStop extends CDispose implements Stop {
+    public static class Stop extends Dispose {
         
         
-        protected CStop(EventRouter router) {
+        protected Stop(EventRouter router) {
             super(router);
             super(router);
         }
         }
         
         
         @Override
         @Override
         public String toString() {
         public String toString() {
-            return "CoreEvent:Stop<" + router() + ">";
+            return "CoreEvent:Stop<" + router + ">";
         }
         }
         
         
     }
     }
@@ -90,28 +81,21 @@ public final class Events {
      * rozsyłany (dokładniej: jego klasa pochodna).
      * rozsyłany (dokładniej: jego klasa pochodna).
      * @see InterruptEvent
      * @see InterruptEvent
      */
      */
-    public interface Shutdown extends Event {
+    public static class Shutdown implements Event {
         
         
-        EventRouter router();
+        protected final EventRouter router;
 
 
-    }
-    
-    private static class CShutdown implements Shutdown {
-        
-        private final EventRouter router;
-
-        public CShutdown(EventRouter router) {
+        protected Shutdown(EventRouter router) {
             this.router = router;
             this.router = router;
         }
         }
         
         
-        @Override
-        public EventRouter router() {
+        public final EventRouter router() {
             return router;
             return router;
         }
         }
         
         
         @Override
         @Override
         public String toString() {
         public String toString() {
-            return "CoreEvent:Shutdown<" + router() + ">";
+            return "CoreEvent:Shutdown<" + router + ">";
         }
         }
 
 
     }
     }
@@ -121,43 +105,34 @@ public final class Events {
      * Informuje, że router zakończył swoją pracę z powodu wymuszenia - nastąpiło
      * Informuje, że router zakończył swoją pracę z powodu wymuszenia - nastąpiło
      * przerwanie i wyjątek {@link InterruptedException}.
      * przerwanie i wyjątek {@link InterruptedException}.
      */
      */
-    public interface Interrupt extends Shutdown { }
-    
-    private static class CInterrupt extends CShutdown implements Interrupt {
+    public static class Interrupt extends Shutdown {
         
         
-        protected CInterrupt(EventRouter name) {
+        protected Interrupt(EventRouter name) {
             super(name);
             super(name);
         }
         }
         
         
         @Override
         @Override
         public String toString() {
         public String toString() {
-            return "CoreEvent:Interrupt<" + router() + ">";
+            return "CoreEvent:Interrupt<" + router + ">";
         }
         }
         
         
     }
     }
 
 
-    public interface Failure extends Event {
-
-        Throwable cause();
-        
-    }
-    
-    private static class CFailure implements Failure {
+    public static class Failure implements Event {
 
 
         private final Throwable cause;
         private final Throwable cause;
 
 
-        protected CFailure(Throwable cause) {
+        protected Failure(Throwable cause) {
             this.cause = cause;
             this.cause = cause;
         }
         }
         
         
-        @Override
-        public Throwable cause() {
+        public final Throwable cause() {
             return cause;
             return cause;
         }
         }
         
         
         @Override
         @Override
         public String toString() {
         public String toString() {
-            return "CoreEvent:Failure<" + cause().getClass().getSimpleName() + ">";
+            return "CoreEvent:Failure: " + cause;
         }
         }
     }
     }