Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
/** @author shevek */
public interface Task<T> {

public static interface Condition {
interface Condition {

static class AlwaysTrue implements Condition {
class AlwaysTrue implements Condition {

private static final AlwaysTrue instance = new AlwaysTrue();

Expand All @@ -41,21 +41,21 @@ public boolean evaluate(@Nonnull TaskSetState state) {
private AlwaysTrue() {}
}

public static final Condition @ArrayLen(0) [] EMPTY_ARRAY = new Condition[0];
Condition @ArrayLen(0) [] EMPTY_ARRAY = new Condition[0];

static Condition alwaysTrue() {
return AlwaysTrue.instance;
}

public boolean evaluate(@Nonnull TaskSetState state);
boolean evaluate(@Nonnull TaskSetState state);

@Nonnull
public default String toSkipReason() {
default String toSkipReason() {
return "[" + this + "] was not true";
}
}

public static class StateCondition implements Condition {
class StateCondition implements Condition {

private final Task<?> task;
private final TaskState taskState;
Expand Down Expand Up @@ -87,7 +87,7 @@ public String toString() {
}
}

public static class AndCondition implements Condition {
class AndCondition implements Condition {

private final List<Condition> conditions;

Expand All @@ -113,7 +113,7 @@ public String toString() {
}

@Nonnull
public default String getName() {
default String getName() {
return getTargetPath();
}

Expand All @@ -123,19 +123,19 @@ default TaskCategory getCategory() {
}

@Nonnull
public String getTargetPath();
String getTargetPath();

@Nonnull
public default Condition[] getConditions() {
default Condition[] getConditions() {
return Condition.EMPTY_ARRAY;
}

@CheckForNull
public T run(@Nonnull TaskRunContext context) throws Exception;
T run(@Nonnull TaskRunContext context) throws Exception;

// returns true if tasks handles the exception.
// so it's not sent to user's screen
public default boolean handleException(Exception Fe) {
default boolean handleException(Exception Fe) {
return false;
}
}