Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/naoty/circuit
[WIP] A runner for serial or parallel tasks
https://github.com/naoty/circuit
Last synced: 21 days ago
JSON representation
[WIP] A runner for serial or parallel tasks
- Host: GitHub
- URL: https://github.com/naoty/circuit
- Owner: naoty
- Created: 2015-04-15T15:10:47.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-04-19T14:59:09.000Z (over 9 years ago)
- Last Synced: 2024-10-22T14:06:10.935Z (2 months ago)
- Language: Java
- Homepage:
- Size: 141 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Circuit
A runner for serial or parallel tasks.
## Usage
### Single task
```java
Task task = new Task() {
@Override
public Integer run(String text) {
return text.length();
}
};task.run("Hello, world!"); //=> 13
```### Serial tasks
```java
// task1 -> task2 -> task3
Task tasks = new SerialTasks.Builder(task1)
.add(task2)
.add(task3)
.build();
tasks.run("Hello, world!");
```### Parallel tasks
```java
// [task1, task2]
Task tasks = new ParallelTasks.Builder()
.add(task1)
.add(task2)
.build();
tasks.run(3);
```### Compound tasks
```java
// task1 -> [task2, task3] -> task4
Task subtasks = ParallelTasks.Builder()
.add(task2)
.add(task3)
.build()
Task tasks = SerialTasks.Builder(task1)
.add(subtasks)
.add(task4)
.build();
tasks.run("Hello, world!");
```## Installation
```groovy
dependencies {
compile "com.github.naoty:circuit:+"
}
```## Author
[naoty](https://github.com/naoty)