-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
2,352 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
src/main/java/hu/akarnokd/rxjava3/bridge/CompletableV2toV3.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* | ||
* Copyright 2019 David Karnok | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package hu.akarnokd.rxjava3.bridge; | ||
|
||
final class CompletableV2toV3 extends io.reactivex.rxjava3.core.Completable | ||
implements io.reactivex.CompletableConverter<io.reactivex.rxjava3.core.Completable> { | ||
|
||
final io.reactivex.Completable source; | ||
|
||
static final CompletableV2toV3 CONVERTER = new CompletableV2toV3(null); | ||
|
||
CompletableV2toV3(io.reactivex.Completable source) { | ||
this.source = source; | ||
} | ||
|
||
@Override | ||
protected void subscribeActual(io.reactivex.rxjava3.core.CompletableObserver s) { | ||
source.subscribe(new CompletableObserverV3toV2(s)); | ||
} | ||
|
||
@Override | ||
public io.reactivex.rxjava3.core.Completable apply(io.reactivex.Completable upstream) { | ||
return new CompletableV2toV3(upstream); | ||
} | ||
|
||
static final class CompletableObserverV3toV2 | ||
implements io.reactivex.CompletableObserver, io.reactivex.rxjava3.disposables.Disposable { | ||
|
||
final io.reactivex.rxjava3.core.CompletableObserver downstream; | ||
|
||
io.reactivex.disposables.Disposable upstream; | ||
|
||
CompletableObserverV3toV2(io.reactivex.rxjava3.core.CompletableObserver downstream) { | ||
this.downstream = downstream; | ||
} | ||
|
||
@Override | ||
public void onSubscribe(io.reactivex.disposables.Disposable d) { | ||
this.upstream = d; | ||
downstream.onSubscribe(this); | ||
} | ||
|
||
@Override | ||
public void onError(Throwable e) { | ||
downstream.onError(e); | ||
} | ||
|
||
@Override | ||
public void onComplete() { | ||
downstream.onComplete(); | ||
} | ||
|
||
@Override | ||
public boolean isDisposed() { | ||
return upstream.isDisposed(); | ||
} | ||
|
||
@Override | ||
public void dispose() { | ||
upstream.dispose(); | ||
} | ||
} | ||
} |
77 changes: 77 additions & 0 deletions
77
src/main/java/hu/akarnokd/rxjava3/bridge/CompletableV3toV2.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* | ||
* Copyright 2019 David Karnok | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package hu.akarnokd.rxjava3.bridge; | ||
|
||
final class CompletableV3toV2 extends io.reactivex.Completable | ||
implements io.reactivex.rxjava3.core.CompletableConverter<io.reactivex.Completable> { | ||
|
||
final io.reactivex.rxjava3.core.Completable source; | ||
|
||
static final CompletableV3toV2 CONVERTER = new CompletableV3toV2(null); | ||
|
||
CompletableV3toV2(io.reactivex.rxjava3.core.Completable source) { | ||
this.source = source; | ||
} | ||
|
||
@Override | ||
protected void subscribeActual(io.reactivex.CompletableObserver s) { | ||
source.subscribe(new CompletableObserverV2toV3(s)); | ||
} | ||
|
||
@Override | ||
public io.reactivex.Completable apply(io.reactivex.rxjava3.core.Completable upstream) { | ||
return new CompletableV3toV2(upstream); | ||
} | ||
|
||
static final class CompletableObserverV2toV3 | ||
implements io.reactivex.rxjava3.core.CompletableObserver, io.reactivex.disposables.Disposable { | ||
|
||
final io.reactivex.CompletableObserver downstream; | ||
|
||
io.reactivex.rxjava3.disposables.Disposable upstream; | ||
|
||
CompletableObserverV2toV3(io.reactivex.CompletableObserver downstream) { | ||
this.downstream = downstream; | ||
} | ||
|
||
@Override | ||
public void onSubscribe(io.reactivex.rxjava3.disposables.Disposable d) { | ||
this.upstream = d; | ||
downstream.onSubscribe(this); | ||
} | ||
|
||
@Override | ||
public void onError(Throwable e) { | ||
downstream.onError(e); | ||
} | ||
|
||
@Override | ||
public void onComplete() { | ||
downstream.onComplete(); | ||
} | ||
|
||
@Override | ||
public boolean isDisposed() { | ||
return upstream.isDisposed(); | ||
} | ||
|
||
@Override | ||
public void dispose() { | ||
upstream.dispose(); | ||
} | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
src/main/java/hu/akarnokd/rxjava3/bridge/DisposableV2toV3.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright 2019 David Karnok | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package hu.akarnokd.rxjava3.bridge; | ||
|
||
final class DisposableV2toV3 implements io.reactivex.rxjava3.disposables.Disposable { | ||
|
||
final io.reactivex.disposables.Disposable disposable; | ||
|
||
DisposableV2toV3(io.reactivex.disposables.Disposable disposable) { | ||
this.disposable = disposable; | ||
} | ||
|
||
@Override | ||
public boolean isDisposed() { | ||
return disposable.isDisposed(); | ||
} | ||
|
||
@Override | ||
public void dispose() { | ||
disposable.dispose(); | ||
} | ||
|
||
static io.reactivex.rxjava3.disposables.Disposable wrap(io.reactivex.disposables.Disposable disposable) { | ||
if (disposable == io.reactivex.internal.disposables.DisposableHelper.DISPOSED) { | ||
return io.reactivex.rxjava3.internal.disposables.DisposableHelper.DISPOSED; | ||
} | ||
if (disposable == io.reactivex.internal.disposables.EmptyDisposable.INSTANCE) { | ||
return io.reactivex.rxjava3.internal.disposables.EmptyDisposable.INSTANCE; | ||
} | ||
return new DisposableV2toV3(disposable); | ||
} | ||
} |
Oops, something went wrong.