diff --git a/core/src/main/java/io/parsingdata/metal/expression/Expression.java b/core/src/main/java/io/parsingdata/metal/expression/Expression.java index 2421ecd1..f80b3d7d 100644 --- a/core/src/main/java/io/parsingdata/metal/expression/Expression.java +++ b/core/src/main/java/io/parsingdata/metal/expression/Expression.java @@ -38,4 +38,5 @@ public interface Expression { ImmutableList eval(ParseGraph graph, Encoding encoding); + // TODO: should the reducing operation be present here? See Util#allTrue } diff --git a/core/src/main/java/io/parsingdata/metal/expression/comparison/ComparisonExpression.java b/core/src/main/java/io/parsingdata/metal/expression/comparison/ComparisonExpression.java index da1dff76..8375f5d8 100644 --- a/core/src/main/java/io/parsingdata/metal/expression/comparison/ComparisonExpression.java +++ b/core/src/main/java/io/parsingdata/metal/expression/comparison/ComparisonExpression.java @@ -16,11 +16,12 @@ package io.parsingdata.metal.expression.comparison; +import static java.util.function.Function.identity; + import static io.parsingdata.metal.SafeTrampoline.complete; import static io.parsingdata.metal.SafeTrampoline.intermediate; import static io.parsingdata.metal.Util.checkNotNull; import static io.parsingdata.metal.data.transformation.Reversal.reverse; -import static java.util.function.Function.identity; import java.util.Objects; import java.util.Optional; diff --git a/core/src/main/java/io/parsingdata/metal/token/While.java b/core/src/main/java/io/parsingdata/metal/token/While.java index a19624f2..89c4b91f 100644 --- a/core/src/main/java/io/parsingdata/metal/token/While.java +++ b/core/src/main/java/io/parsingdata/metal/token/While.java @@ -16,6 +16,7 @@ package io.parsingdata.metal.token; +import static io.parsingdata.metal.Shorthand.expTrue; import static io.parsingdata.metal.Trampoline.complete; import static io.parsingdata.metal.Trampoline.intermediate; import static io.parsingdata.metal.Util.allTrue; @@ -26,8 +27,6 @@ import java.util.Objects; import java.util.Optional; -import static io.parsingdata.metal.Shorthand.expTrue; - import io.parsingdata.metal.Trampoline; import io.parsingdata.metal.Util; import io.parsingdata.metal.data.Environment; diff --git a/core/src/test/java/io/parsingdata/metal/CompoundExpressionTest.java b/core/src/test/java/io/parsingdata/metal/CompoundExpressionTest.java index 0cab23e6..2a04d36d 100644 --- a/core/src/test/java/io/parsingdata/metal/CompoundExpressionTest.java +++ b/core/src/test/java/io/parsingdata/metal/CompoundExpressionTest.java @@ -1,3 +1,19 @@ +/* + * Copyright 2013-2016 Netherlands Forensic Institute + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.parsingdata.metal; import static io.parsingdata.metal.Util.allTrue; @@ -64,8 +80,8 @@ public void evalGtEqNum() throws IOException { assertFalse(allTrue(gtEqNum(ref("value"), rev(ref("other"))).eval(graph, enc()))); } - private static Expression imp(final Expression l, final Expression r) { - return or(not(l), r); + private static Expression imp(final Expression left, final Expression right) { + return or(not(left), right); } private static Expression gtEqNum(final ValueExpression value, final ValueExpression predicate) {