Skip to content

Commit d297bef

Browse files
Merge pull request #1 from benjchristensen/api-and-naming
Refactoring conventions
2 parents 87cfa7a + 9d48f99 commit d297bef

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+4589
-4650
lines changed

rxjava-core/build.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
apply plugin: 'java'
22
apply plugin: 'eclipse'
33

4+
// we want to target Java 1.5 so this can be used on Android
5+
sourceCompatibility = JavaVersion.VERSION_1_5
6+
targetCompatibility = JavaVersion.VERSION_1_5
7+
48
dependencies {
59
compile 'org.slf4j:slf4j-api:1.7.0'
610
compile 'com.google.code.findbugs:jsr305:2.0.0'

rxjava-core/src/main/java/org/rx/functions/Func0.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
public interface Func0<R> {
44
public R call();
5-
}
5+
}

rxjava-core/src/main/java/org/rx/functions/Func1.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
public interface Func1<R, T1> {
44
public R call(T1 t1);
5-
}
5+
}

rxjava-core/src/main/java/org/rx/functions/Func2.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
public interface Func2<R, T1, T2> {
44
public R call(T1 t1, T2 t2);
5-
}
5+
}

rxjava-core/src/main/java/org/rx/functions/Func3.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
public interface Func3<R, T1, T2, T3> {
44
public R call(T1 t1, T2 t2, T3 t3);
5-
}
5+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
package org.rx.functions;
22

33
public interface Func4<R, T1, T2, T3, T4> {
4-
public R call(T1 t1, T2 t2, T3 t3, T4 t4);
4+
public R call(T1 t1, T2 t2, T3 t3, T4 t4);
55
}

rxjava-core/src/main/java/org/rx/operations/AtomicWatchableSubscription.java renamed to rxjava-core/src/main/java/org/rx/operations/AtomicObservableSubscription.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,22 @@
55

66
import javax.annotation.concurrent.ThreadSafe;
77

8-
import org.rx.reactive.IDisposable;
9-
8+
import org.rx.reactive.Subscription;
109

1110
/**
12-
* Thread-safe wrapper around WatchableSubscription that ensures unsubscribe can be called only once.
11+
* Thread-safe wrapper around ObservableSubscription that ensures unsubscribe can be called only once.
1312
*/
1413
@ThreadSafe
15-
/* package */class AtomicWatchableSubscription implements IDisposable {
14+
/* package */final class AtomicObservableSubscription implements Subscription {
1615

17-
private AtomicReference<IDisposable> actualSubscription = new AtomicReference<IDisposable>();
16+
private AtomicReference<Subscription> actualSubscription = new AtomicReference<Subscription>();
1817
private AtomicBoolean unsubscribed = new AtomicBoolean(false);
1918

20-
public AtomicWatchableSubscription() {
19+
public AtomicObservableSubscription() {
2120

2221
}
2322

24-
public AtomicWatchableSubscription(IDisposable actualSubscription) {
23+
public AtomicObservableSubscription(Subscription actualSubscription) {
2524
this.actualSubscription.set(actualSubscription);
2625
}
2726

@@ -32,7 +31,7 @@ public AtomicWatchableSubscription(IDisposable actualSubscription) {
3231
* @throws IllegalStateException
3332
* if trying to set more than once (or use this method after setting via constructor)
3433
*/
35-
public AtomicWatchableSubscription setActual(IDisposable actualSubscription) {
34+
public AtomicObservableSubscription setActual(Subscription actualSubscription) {
3635
if (!this.actualSubscription.compareAndSet(null, actualSubscription)) {
3736
throw new IllegalStateException("Can not set subscription more than once.");
3837
}
@@ -42,7 +41,7 @@ public AtomicWatchableSubscription setActual(IDisposable actualSubscription) {
4241
@Override
4342
public void unsubscribe() {
4443
// get the real thing and set to null in an atomic operation so we will only ever call unsubscribe once
45-
IDisposable actual = actualSubscription.getAndSet(null);
44+
Subscription actual = actualSubscription.getAndSet(null);
4645
// if it's not null we will unsubscribe
4746
if (actual != null) {
4847
actual.unsubscribe();

rxjava-core/src/main/java/org/rx/operations/AtomicWatcher.java renamed to rxjava-core/src/main/java/org/rx/operations/AtomicObserver.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
import javax.annotation.concurrent.ThreadSafe;
44

5-
import org.rx.reactive.IObserver;
5+
import org.rx.reactive.Observer;
66

77
/**
8-
* A thread-safe Watcher for transitioning states in operators.
8+
* A thread-safe Observer for transitioning states in operators.
99
* <p>
1010
* Allows both single-threaded and multi-threaded execution controlled by the following FastProperty:
11-
* <li>reactive.watcher.multithreaded.enabled [Default: false]</li>
11+
* <li>reactive.Observer.multithreaded.enabled [Default: false]</li>
1212
* <p>
1313
* Single-threaded Execution rules are:
1414
* <ul>
@@ -29,7 +29,7 @@
2929
* @param <T>
3030
*/
3131
@ThreadSafe
32-
/* package */class AtomicWatcher<T> implements IObserver<T> {
32+
/* package */final class AtomicObserver<T> implements Observer<T> {
3333

3434
/** Allow changing between forcing single or allowing multi-threaded execution of onNext */
3535
private static boolean allowMultiThreaded = true;
@@ -41,29 +41,29 @@
4141
}
4242
}
4343

44-
private final IObserver<T> watcher;
44+
private final Observer<T> Observer;
4545

46-
public AtomicWatcher(IObserver<T> watcher, AtomicWatchableSubscription subscription) {
46+
public AtomicObserver(Observer<T> Observer, AtomicObservableSubscription subscription) {
4747
if (allowMultiThreaded) {
48-
this.watcher = new AtomicWatcherMultiThreaded<T>(watcher, subscription);
48+
this.Observer = new AtomicObserverMultiThreaded<T>(Observer, subscription);
4949
} else {
50-
this.watcher = new AtomicWatcherSingleThreaded<T>(watcher, subscription);
50+
this.Observer = new AtomicObserverSingleThreaded<T>(Observer, subscription);
5151
}
5252
}
5353

5454
@Override
5555
public void onCompleted() {
56-
watcher.onCompleted();
56+
Observer.onCompleted();
5757
}
5858

5959
@Override
6060
public void onError(Exception e) {
61-
watcher.onError(e);
61+
Observer.onError(e);
6262
}
6363

6464
@Override
6565
public void onNext(T args) {
66-
watcher.onNext(args);
66+
Observer.onNext(args);
6767
}
6868

6969
}

0 commit comments

Comments
 (0)