Skip to content

Commit

Permalink
Remove redundant methods from Sample(Observable) (#6469)
Browse files Browse the repository at this point in the history
* Update Maybe.java

* Update Single.java

* Update ObservableSampleWithObservable.java

* Update FlowableSamplePublisher.java

* Update FlowableSamplePublisher.java
  • Loading branch information
lxsmnsyc authored and akarnokd committed Apr 26, 2019
1 parent deeb141 commit b570c91
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public void onError(Throwable t) {
@Override
public void onComplete() {
SubscriptionHelper.cancel(other);
completeMain();
completion();
}

void setOther(Subscription o) {
Expand All @@ -117,7 +117,7 @@ public void error(Throwable e) {

public void complete() {
upstream.cancel();
completeOther();
completion();
}

void emit() {
Expand All @@ -134,9 +134,7 @@ void emit() {
}
}

abstract void completeMain();

abstract void completeOther();
abstract void completion();

abstract void run();
}
Expand Down Expand Up @@ -178,12 +176,7 @@ static final class SampleMainNoLast<T> extends SamplePublisherSubscriber<T> {
}

@Override
void completeMain() {
downstream.onComplete();
}

@Override
void completeOther() {
void completion() {
downstream.onComplete();
}

Expand All @@ -207,16 +200,7 @@ static final class SampleMainEmitLast<T> extends SamplePublisherSubscriber<T> {
}

@Override
void completeMain() {
done = true;
if (wip.getAndIncrement() == 0) {
emit();
downstream.onComplete();
}
}

@Override
void completeOther() {
void completion() {
done = true;
if (wip.getAndIncrement() == 0) {
emit();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public void onError(Throwable t) {
@Override
public void onComplete() {
DisposableHelper.dispose(other);
completeMain();
completion();
}

boolean setOther(Disposable o) {
Expand All @@ -109,7 +109,7 @@ public void error(Throwable e) {

public void complete() {
upstream.dispose();
completeOther();
completion();
}

void emit() {
Expand All @@ -119,9 +119,7 @@ void emit() {
}
}

abstract void completeMain();

abstract void completeOther();
abstract void completion();

abstract void run();
}
Expand Down Expand Up @@ -163,12 +161,7 @@ static final class SampleMainNoLast<T> extends SampleMainObserver<T> {
}

@Override
void completeMain() {
downstream.onComplete();
}

@Override
void completeOther() {
void completion() {
downstream.onComplete();
}

Expand All @@ -192,16 +185,7 @@ static final class SampleMainEmitLast<T> extends SampleMainObserver<T> {
}

@Override
void completeMain() {
done = true;
if (wip.getAndIncrement() == 0) {
emit();
downstream.onComplete();
}
}

@Override
void completeOther() {
void completion() {
done = true;
if (wip.getAndIncrement() == 0) {
emit();
Expand Down

0 comments on commit b570c91

Please sign in to comment.