Debian Codegraph @

src/main/java/io/reactivex/rxjava3/internal/fuseable/AbstractEmptyQueueFuseable.java

raw
1 /*
2 * Copyright (c) 2016-present, RxJava Contributors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
5 * compliance with the License. You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software distributed under the License is
10 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See
11 * the License for the specific language governing permissions and limitations under the License.
12 */
13
14 package io.reactivex.rxjava3.internal.fuseable;
15
16 import io.reactivex.rxjava3.annotations.NonNull;
17 import io.reactivex.rxjava3.operators.QueueDisposable;
18 import io.reactivex.rxjava3.operators.QueueFuseable;
19 import io.reactivex.rxjava3.operators.QueueSubscription;
20
21 /**
22 * Represents an empty, async-only {@link QueueFuseable} instance.
23 *
24 * @param <T> the output value type
25 * @since 3.0.0
26 */
27 public abstract class AbstractEmptyQueueFuseable<T>
28 implements QueueSubscription<T>, QueueDisposable<T> {
29
30 @Override
31 public final int requestFusion(int mode) {
32 return mode & ASYNC;
33 }
34
35 @Override
36 public final boolean offer(@NonNull T value) {
37 throw new UnsupportedOperationException("Should not be called!");
38 }
39
40 @Override
41 public final boolean offer(@NonNull T v1, @NonNull T v2) {
42 throw new UnsupportedOperationException("Should not be called!");
43 }
44
45 @Override
46 public final T poll() throws Throwable {
47 return null; // always empty
48 }
49
50 @Override
51 public final boolean isEmpty() {
52 return true; // always empty
53 }
54
55 @Override
56 public final void clear() {
57 // always empty
58 }
59
60 @Override
61 public final void request(long n) {
62 // no items to request
63 }
64
65 @Override
66 public void cancel() {
67 // default No-op
68 }
69
70 @Override
71 public void dispose() {
72 // default No-op
73 }
74
75 @Override
76 public boolean isDisposed() {
77 return false;
78 }
79 }