-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into sync-lock
- Loading branch information
Showing
32 changed files
with
487 additions
and
694 deletions.
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
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 |
---|---|---|
|
@@ -25,6 +25,7 @@ | |
|
||
import java.util.concurrent.Callable; | ||
import org.cactoos.Func; | ||
import org.cactoos.Proc; | ||
|
||
/** | ||
* Func as {@link Callable}. | ||
|
@@ -41,26 +42,60 @@ | |
* | ||
* @author Yegor Bugayenko ([email protected]) | ||
* @version $Id$ | ||
* @param <T> Type of input | ||
* @since 0.2 | ||
* @param <X> Type of input | ||
* @param <T> Type of output | ||
* @since 0.12 | ||
*/ | ||
public final class FuncAsCallable<T> implements Callable<T> { | ||
public final class CallableOf<X, T> implements Callable<T> { | ||
|
||
/** | ||
* Original func. | ||
*/ | ||
private final Func<?, T> func; | ||
private final Func<X, T> func; | ||
|
||
/** | ||
* The input. | ||
*/ | ||
private final X input; | ||
|
||
/** | ||
* Ctor. | ||
* @param runnable Encapsulated proc | ||
* @since 0.12 | ||
*/ | ||
public CallableOf(final Runnable runnable) { | ||
this(new FuncOf<>(runnable)); | ||
} | ||
|
||
/** | ||
* Ctor. | ||
* @param proc Encapsulated proc | ||
* @since 0.12 | ||
*/ | ||
public CallableOf(final Proc<X> proc) { | ||
this(new FuncOf<>(proc)); | ||
} | ||
|
||
/** | ||
* Ctor. | ||
* @param fnc Encapsulated func | ||
*/ | ||
public CallableOf(final Func<X, T> fnc) { | ||
this(fnc, null); | ||
} | ||
|
||
/** | ||
* Ctor. | ||
* @param fnc Encapsulated func | ||
* @param ipt Input | ||
*/ | ||
public FuncAsCallable(final Func<?, T> fnc) { | ||
public CallableOf(final Func<X, T> fnc, final X ipt) { | ||
this.func = fnc; | ||
this.input = ipt; | ||
} | ||
|
||
@Override | ||
public T call() throws Exception { | ||
return this.func.apply(null); | ||
return this.func.apply(this.input); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.