2-APL UPC project.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 45 lines 698 B view raw
1package blockworld.lib; 2 3/// works like an observable, allows emitting signals 4import java.util.Observable; 5 6public class Signal extends Observable { 7 protected String _name; 8 9 protected long _counter = 0; 10 11 public Signal( String name ) { 12 _name = name; 13 } 14 15 public void emit() { 16 emit( null ); 17 } 18 19 public void emit( Object o ) { 20 setChanged(); 21 notifyObservers( o ); 22 _counter++; 23 } 24 25 public void setChanged() { 26 super.setChanged(); 27 } 28 29 public void clearChanged() { 30 super.clearChanged(); 31 } 32 33 public String toString() { 34 return _name; 35 } 36 37 public String getName() { 38 return _name; 39 } 40 41 public long getEmitCount() { 42 return _counter; 43 } 44 45}