Skip to content

Commit

Permalink
refactor: reorder methods tuple* methods, consistent with other met…
Browse files Browse the repository at this point in the history
…hods 💅
  • Loading branch information
oldratlee committed Jun 24, 2024
1 parent b4d19ce commit 4c6e016
Show file tree
Hide file tree
Showing 3 changed files with 231 additions and 230 deletions.
1 change: 1 addition & 0 deletions cffu-core/src/main/java/io/foldright/cffu/Cffu.java
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ public Cffu<Void> thenRunAsync(Runnable action, Executor executor) {
return reset0(cf.thenRunAsync(action, executor));
}

// endregion
////////////////////////////////////////////////////////////
// region## Then-Multi-Actions(thenM*) Methods
////////////////////////////////////////////////////////////
Expand Down
124 changes: 62 additions & 62 deletions cffu-core/src/main/java/io/foldright/cffu/CffuFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -534,21 +534,6 @@ public <T1, T2> Cffu<Tuple2<T1, T2>> allTupleOfFastFail(
return create(CompletableFutureUtils.allTupleOfFastFail(cf1, cf2));
}

/**
* Returns a new Cffu that is completed when the given two stages complete.
* If any of the given stages complete exceptionally, then the returned Cffu also does so,
* with a CompletionException holding this exception as its cause.
*
* @return a new Cffu that is completed when the given two stages complete
* @throws NullPointerException if any of the given stages are {@code null}
* @see #allResultsOf(CompletionStage[])
*/
@Contract(pure = true)
public <T1, T2> Cffu<Tuple2<T1, T2>> allTupleOf(
CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2) {
return create(CompletableFutureUtils.allTupleOf(cf1, cf2));
}

/**
* Returns a new Cffu that is successful when the given three stages success.
* If any of the given stages complete exceptionally, then the returned Cffu also does so
Expand All @@ -567,21 +552,6 @@ public <T1, T2, T3> Cffu<Tuple3<T1, T2, T3>> allTupleOfFastFail(
return create(CompletableFutureUtils.allTupleOfFastFail(cf1, cf2, cf3));
}

/**
* Returns a new Cffu that is completed when the given three stages complete.
* If any of the given stages complete exceptionally, then the returned Cffu also does so,
* with a CompletionException holding this exception as its cause.
*
* @return a new Cffu that is completed when the given three stages complete
* @throws NullPointerException if any of the given stages are {@code null}
* @see #allResultsOf(CompletionStage[])
*/
@Contract(pure = true)
public <T1, T2, T3> Cffu<Tuple3<T1, T2, T3>> allTupleOf(
CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2, CompletionStage<? extends T3> cf3) {
return create(CompletableFutureUtils.allTupleOf(cf1, cf2, cf3));
}

/**
* Returns a new Cffu that is successful when the given four stages success.
* If any of the given stages complete exceptionally, then the returned Cffu also does so
Expand All @@ -601,22 +571,6 @@ public <T1, T2, T3, T4> Cffu<Tuple4<T1, T2, T3, T4>> allTupleOfFastFail(
return create(CompletableFutureUtils.allTupleOfFastFail(cf1, cf2, cf3, cf4));
}

/**
* Returns a new Cffu that is completed when the given four stages complete.
* If any of the given stages complete exceptionally, then the returned Cffu also does so,
* with a CompletionException holding this exception as its cause.
*
* @return a new Cffu that is completed when the given four stages complete
* @throws NullPointerException if any of the given stages are {@code null}
* @see #allResultsOf(CompletionStage[])
*/
@Contract(pure = true)
public <T1, T2, T3, T4> Cffu<Tuple4<T1, T2, T3, T4>> allTupleOf(
CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2,
CompletionStage<? extends T3> cf3, CompletionStage<? extends T4> cf4) {
return create(CompletableFutureUtils.allTupleOf(cf1, cf2, cf3, cf4));
}

/**
* Returns a new Cffu that is successful when the given five stages success.
* If any of the given stages complete exceptionally, then the returned Cffu also does so
Expand All @@ -636,22 +590,6 @@ public <T1, T2, T3, T4, T5> Cffu<Tuple5<T1, T2, T3, T4, T5>> allTupleOfFastFail(
return create(CompletableFutureUtils.allTupleOfFastFail(cf1, cf2, cf3, cf4, cf5));
}

/**
* Returns a new Cffu that is completed when the given five stages complete.
* If any of the given stages complete exceptionally, then the returned Cffu also does so,
* with a CompletionException holding this exception as its cause.
*
* @return a new Cffu that is completed when the given five stages complete
* @throws NullPointerException if any of the given stages are {@code null}
* @see #allResultsOf(CompletionStage[])
*/
@Contract(pure = true)
public <T1, T2, T3, T4, T5> Cffu<Tuple5<T1, T2, T3, T4, T5>> allTupleOf(
CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2, CompletionStage<? extends T3> cf3,
CompletionStage<? extends T4> cf4, CompletionStage<? extends T5> cf5) {
return create(CompletableFutureUtils.allTupleOf(cf1, cf2, cf3, cf4, cf5));
}

/**
* Returns a new Cffu with the most results in the <strong>same order</strong> of
* the given two stages arguments in the given time({@code timeout}, aka as many results as possible in the given time).
Expand Down Expand Up @@ -729,6 +667,68 @@ public <T1, T2, T3, T4, T5> Cffu<Tuple5<T1, T2, T3, T4, T5>> mostTupleOfSuccess(
return create(CompletableFutureUtils.mostTupleOfSuccess(defaultExecutor, timeout, unit, cf1, cf2, cf3, cf4, cf5));
}

/**
* Returns a new Cffu that is completed when the given two stages complete.
* If any of the given stages complete exceptionally, then the returned Cffu also does so,
* with a CompletionException holding this exception as its cause.
*
* @return a new Cffu that is completed when the given two stages complete
* @throws NullPointerException if any of the given stages are {@code null}
* @see #allResultsOf(CompletionStage[])
*/
@Contract(pure = true)
public <T1, T2> Cffu<Tuple2<T1, T2>> allTupleOf(
CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2) {
return create(CompletableFutureUtils.allTupleOf(cf1, cf2));
}

/**
* Returns a new Cffu that is completed when the given three stages complete.
* If any of the given stages complete exceptionally, then the returned Cffu also does so,
* with a CompletionException holding this exception as its cause.
*
* @return a new Cffu that is completed when the given three stages complete
* @throws NullPointerException if any of the given stages are {@code null}
* @see #allResultsOf(CompletionStage[])
*/
@Contract(pure = true)
public <T1, T2, T3> Cffu<Tuple3<T1, T2, T3>> allTupleOf(
CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2, CompletionStage<? extends T3> cf3) {
return create(CompletableFutureUtils.allTupleOf(cf1, cf2, cf3));
}

/**
* Returns a new Cffu that is completed when the given four stages complete.
* If any of the given stages complete exceptionally, then the returned Cffu also does so,
* with a CompletionException holding this exception as its cause.
*
* @return a new Cffu that is completed when the given four stages complete
* @throws NullPointerException if any of the given stages are {@code null}
* @see #allResultsOf(CompletionStage[])
*/
@Contract(pure = true)
public <T1, T2, T3, T4> Cffu<Tuple4<T1, T2, T3, T4>> allTupleOf(
CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2,
CompletionStage<? extends T3> cf3, CompletionStage<? extends T4> cf4) {
return create(CompletableFutureUtils.allTupleOf(cf1, cf2, cf3, cf4));
}

/**
* Returns a new Cffu that is completed when the given five stages complete.
* If any of the given stages complete exceptionally, then the returned Cffu also does so,
* with a CompletionException holding this exception as its cause.
*
* @return a new Cffu that is completed when the given five stages complete
* @throws NullPointerException if any of the given stages are {@code null}
* @see #allResultsOf(CompletionStage[])
*/
@Contract(pure = true)
public <T1, T2, T3, T4, T5> Cffu<Tuple5<T1, T2, T3, T4, T5>> allTupleOf(
CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2, CompletionStage<? extends T3> cf3,
CompletionStage<? extends T4> cf4, CompletionStage<? extends T5> cf5) {
return create(CompletableFutureUtils.allTupleOf(cf1, cf2, cf3, cf4, cf5));
}

// endregion
////////////////////////////////////////////////////////////////////////////////
// region## Immediate Value Argument Factory Methods
Expand Down
Loading

0 comments on commit 4c6e016

Please sign in to comment.