git://wamblee.org
/
utils
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
updated coding rules.
[utils]
/
support
/
general
/
src
/
main
/
java
/
org
/
wamblee
/
observer
/
Observable.java
diff --git
a/support/general/src/main/java/org/wamblee/observer/Observable.java
b/support/general/src/main/java/org/wamblee/observer/Observable.java
index 2980afafd33dbc63a0a7416e6aed4ca7cb2396c9..820db38c8bb3241b61d3d3a12ab19585351ae4d4 100644
(file)
--- a/
support/general/src/main/java/org/wamblee/observer/Observable.java
+++ b/
support/general/src/main/java/org/wamblee/observer/Observable.java
@@
-34,22
+34,22
@@
public class Observable<ObservableType, Event> {
/**
* Observable.
*/
/**
* Observable.
*/
- private ObservableType
_
observable;
+ private ObservableType observable;
/**
* Used to notify observers.
*/
/**
* Used to notify observers.
*/
- private ObserverNotifier<ObservableType, Event>
_
notifier;
+ private ObserverNotifier<ObservableType, Event> notifier;
/**
* Map of subscription to observer.
*/
/**
* Map of subscription to observer.
*/
- private Map<Long, Observer<ObservableType, Event>>
_
observers;
+ private Map<Long, Observer<ObservableType, Event>> observers;
/**
* Counter for subscriptions. Holds the next subscription.
*/
/**
* Counter for subscriptions. Holds the next subscription.
*/
- private long
_
counter;
+ private long counter;
/**
* Constructs the observable.
/**
* Constructs the observable.
@@
-61,10
+61,10
@@
public class Observable<ObservableType, Event> {
*/
public Observable(ObservableType aObservable,
ObserverNotifier<ObservableType, Event> aNotifier) {
*/
public Observable(ObservableType aObservable,
ObserverNotifier<ObservableType, Event> aNotifier) {
-
_
observable = aObservable;
-
_
notifier = aNotifier;
-
_
observers = new TreeMap<Long, Observer<ObservableType, Event>>();
-
_
counter = 0;
+ observable = aObservable;
+ notifier = aNotifier;
+ observers = new TreeMap<Long, Observer<ObservableType, Event>>();
+ counter = 0;
}
/**
}
/**
@@
-75,9
+75,9
@@
public class Observable<ObservableType, Event> {
* @return Event Event to send.
*/
public synchronized long subscribe(Observer<ObservableType, Event> aObserver) {
* @return Event Event to send.
*/
public synchronized long subscribe(Observer<ObservableType, Event> aObserver) {
- long subscription =
_
counter++; // integer rage is so large it will
+ long subscription = counter++; // integer rage is so large it will
// never roll over.
// never roll over.
-
_
observers.put(subscription, aObserver);
+ observers.put(subscription, aObserver);
return subscription;
}
return subscription;
}
@@
-90,7
+90,7
@@
public class Observable<ObservableType, Event> {
* In case the subscription is not known.
*/
public synchronized void unsubscribe(long aSubscription) {
* In case the subscription is not known.
*/
public synchronized void unsubscribe(long aSubscription) {
- Object obj =
_
observers.remove(aSubscription);
+ Object obj = observers.remove(aSubscription);
if (obj == null) {
throw new IllegalArgumentException("Subscription '" + aSubscription
+ "'");
if (obj == null) {
throw new IllegalArgumentException("Subscription '" + aSubscription
+ "'");
@@
-103,7
+103,7
@@
public class Observable<ObservableType, Event> {
* @return Number of subscribed observers.
*/
public int getObserverCount() {
* @return Number of subscribed observers.
*/
public int getObserverCount() {
- return
_
observers.size();
+ return observers.size();
}
/**
}
/**
@@
-116,12
+116,12
@@
public class Observable<ObservableType, Event> {
// Make sure we do the notification while not holding the lock to avoid
// potential deadlock
// situations.
// Make sure we do the notification while not holding the lock to avoid
// potential deadlock
// situations.
- List<Observer<ObservableType, Event>>
o
bservers = new ArrayList<Observer<ObservableType, Event>>();
+ List<Observer<ObservableType, Event>>
myO
bservers = new ArrayList<Observer<ObservableType, Event>>();
synchronized (this) {
synchronized (this) {
-
observers.addAll(_
observers.values());
+
myObservers.addAll(
observers.values());
}
}
- for (Observer<ObservableType, Event> observer :
o
bservers) {
-
_notifier.update(observer, _
observable, aEvent);
+ for (Observer<ObservableType, Event> observer :
myO
bservers) {
+
notifier.update(observer,
observable, aEvent);
}
}
}
}
@@
-132,10
+132,10
@@
public class Observable<ObservableType, Event> {
*/
@Override
protected void finalize() throws Throwable {
*/
@Override
protected void finalize() throws Throwable {
- if (
_
observers.size() > 0) {
+ if (observers.size() > 0) {
LOGGER
.error("Still observers registered at finalization of observer!");
LOGGER
.error("Still observers registered at finalization of observer!");
- for (Observer observer :
_
observers.values()) {
+ for (Observer observer : observers.values()) {
LOGGER.error(" observer: " + observer);
}
}
LOGGER.error(" observer: " + observer);
}
}