Skip to content

Commit b441197

Browse files
committed
Refactoring Greek
1 parent cdd6345 commit b441197

File tree

7 files changed

+22
-22
lines changed

7 files changed

+22
-22
lines changed

src/main/java/net/tascalate/concurrent/CompletableFutureWrapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public CompletableFuture<T> toCompletableFuture() {
6262

6363
// Report self-origin
6464
@Override
65-
public CompletionStage<T> τ() {
65+
public CompletionStage<T> α() {
6666
return this;
6767
}
6868

src/main/java/net/tascalate/concurrent/CompletablePromise.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public CompletableFuture<T> toCompletableFuture() {
120120
}
121121

122122
@Override
123-
public CompletionStage<T> τ() {
123+
public CompletionStage<T> α() {
124124
return delegate;
125125
}
126126

src/main/java/net/tascalate/concurrent/ConfigurableDependentPromise.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -834,8 +834,8 @@ public CompletableFuture<T> toCompletableFuture() {
834834

835835
@Override
836836
public CompletableFuture<T> toCompletableFuture(boolean enlistOrigin) {
837-
CompletionStage<T> tau = tauOf(delegate);
838-
CompletableFuture<T> rootDelegate = tau instanceof CompletableFuture ? (CompletableFuture<T>)tau : null;
837+
CompletionStage<T> alpha = alphaOf(delegate);
838+
CompletableFuture<T> rootDelegate = alpha instanceof CompletableFuture ? (CompletableFuture<T>)alpha : null;
839839
CompletableFuture<T> result;
840840
if (enlistOrigin) {
841841
if (rootDelegate != null) {
@@ -866,8 +866,8 @@ public boolean cancel(boolean mayInterruptIfRunning) {
866866
}
867867

868868
@Override
869-
public CompletionStage<T> τ() {
870-
return tauOf(delegate);
869+
public CompletionStage<T> α() {
870+
return alphaOf(delegate);
871871
}
872872

873873
@Override
@@ -879,11 +879,11 @@ public String toString() {
879879
);
880880
}
881881

882-
private static <T> CompletionStage<T> tauOf(Promise<T> promise) {
882+
private static <T> CompletionStage<T> alphaOf(Promise<T> promise) {
883883
if (promise instanceof Delegator) {
884884
@SuppressWarnings("unchecked")
885885
Delegator<T> delegator = (Delegator<T>)promise;
886-
return delegator.τ();
886+
return delegator.α();
887887
} else {
888888
return promise;
889889
}

src/main/java/net/tascalate/concurrent/DependentPromise.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ public interface DependentPromise<T> extends Promise<T> {
7070

7171
@Override
7272
default <D> D as(Function<? super Promise<T>, D> decoratorFactory) {
73-
return as_(decoratorFactory);
73+
return asʹ(decoratorFactory);
7474
}
7575

76-
default <D> D as_(Function<? super DependentPromise<T>, D> decoratorFactory) {
76+
default <D> D asʹ(Function<? super DependentPromise<T>, D> decoratorFactory) {
7777
return decoratorFactory.apply(this);
7878
}
7979

src/main/java/net/tascalate/concurrent/core/Delegator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@
1818
import java.util.concurrent.CompletionStage;
1919

2020
public interface Delegator<T> {
21-
CompletionStage<T> τ();
21+
CompletionStage<T> α();
2222
}

src/main/java/net/tascalate/concurrent/decorators/AbstractPromiseLikeDecorator.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -272,11 +272,12 @@ public <U> Promise<U> handleAsync(BiFunction<? super T, Throwable, ? extends U>
272272
return cast(super.handleAsync(fn, executor));
273273
}
274274

275-
// Tau-operator -- the origin of origins
276-
public CompletionStage<T> τ() {
275+
// Alpha-operator -- the origin of origins
276+
@Override
277+
public CompletionStage<T> α() {
277278
CompletionStage<T> p = delegate;
278279
if (p instanceof Delegator) {
279-
return delegator(p).τ();
280+
return delegator(p).α();
280281
} else {
281282
// Default path -- unroll
282283
while (p instanceof AbstractCompletionStageDecorator) {
@@ -285,7 +286,7 @@ public <U> Promise<U> handleAsync(BiFunction<? super T, Throwable, ? extends U>
285286
(AbstractCompletionStageDecorator<T, ? extends CompletionStage<T>>)p;
286287
p = ap.delegate;
287288
if (p instanceof Delegator) {
288-
return delegator(p).τ();
289+
return delegator(p).α();
289290
}
290291
}
291292
return p;

src/test/java/net/tascalate/concurrent/J8Examples.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,17 +107,17 @@ public static void main(final String[] argv) throws InterruptedException, Execut
107107

108108
final TaskExecutorService executorService = TaskExecutors.newFixedThreadPool(6, tf);
109109

110-
System.out.println(new CustomizablePromiseDecorator<>(CompletableTask.completed("", executorService).defaultAsyncOn(executorService), null).τ());
111-
System.out.println(new CustomizablePromiseDecorator<>(Promises.success(11).defaultAsyncOn(executorService), null).τ());
112-
System.out.println(new CustomizablePromiseDecorator<>(new CompletablePromise<Long>().defaultAsyncOn(executorService), null).τ());
110+
System.out.println(new CustomizablePromiseDecorator<>(CompletableTask.completed("", executorService).defaultAsyncOn(executorService), null).α());
111+
System.out.println(new CustomizablePromiseDecorator<>(Promises.success(11).defaultAsyncOn(executorService), null).α());
112+
System.out.println(new CustomizablePromiseDecorator<>(new CompletablePromise<Long>().defaultAsyncOn(executorService), null).α());
113113

114114
Promise<?> t =
115115
Promises.success("11")
116116
//CompletableTask
117117
// .supplyAsync(() -> "11", executorService)
118118
.dependent()
119-
.as_(peek(p -> p.thenApply(Integer::parseInt)))
120-
.as_(peek(System.out::println))
119+
.asʹ(peek(p -> p.thenApply(Integer::parseInt)))
120+
.asʹ(peek(System.out::println))
121121
.thenComposeAsync(v -> {
122122
System.out.println("In compose " + v);
123123
try {
@@ -140,11 +140,10 @@ public static void main(final String[] argv) throws InterruptedException, Execut
140140
throw new CompletionException(ex);
141141
}
142142
}, executorService, true);
143-
144143
Thread.sleep(500);
145144
t.cancel(true);
146145
System.out.println("Is cancelled ? " + t.isCancelled());
147-
146+
148147
AsyncSemaphoreLock lock = AsyncSemaphoreLock.create(7, true);
149148
for (int i = 0; i < 10; i++) {
150149
int idx = i;

0 commit comments

Comments
 (0)