Search in sources :

Example 16 with Op

use of uk.me.parabola.mkgmap.osmstyle.eval.Op in project mkgmap by openstreetmap.

the class ExpressionArrangerTest method testExitsAndFunction.

@Test
public void testExitsAndFunction() {
    Op op = createOp("$a=* & is_closed()=true {name 'n466'} [0x2]");
    System.out.println(fmtExpr(op));
    op = arranger.arrange(op);
    System.out.println(fmtExpr(op));
    assertTrue(isSolved(op));
    assertTrue(op.getFirst().getType() != NodeType.FUNCTION);
}
Also used : Op(uk.me.parabola.mkgmap.osmstyle.eval.Op) LinkedOp(uk.me.parabola.mkgmap.osmstyle.eval.LinkedOp) Test(org.junit.Test)

Example 17 with Op

use of uk.me.parabola.mkgmap.osmstyle.eval.Op in project mkgmap by openstreetmap.

the class ExpressionArrangerTest method testBasicOr.

@Test
public void testBasicOr() {
    Op op = createOp("a<2 & b=1 | a<1 & b=2");
    op = arranger.arrange(op);
    assertTrue(isSolved(op));
}
Also used : Op(uk.me.parabola.mkgmap.osmstyle.eval.Op) LinkedOp(uk.me.parabola.mkgmap.osmstyle.eval.LinkedOp) Test(org.junit.Test)

Example 18 with Op

use of uk.me.parabola.mkgmap.osmstyle.eval.Op in project mkgmap by openstreetmap.

the class ExpressionArrangerTest method testOrWithNotFailure.

@Test
public void testOrWithNotFailure() {
    Op op = createOp("$b<2 | !($b!=1 & $b!=2) | $a~1 {name 'n466'} [0x2]");
    System.out.println(fmtExpr(op));
    op = arranger.arrange(op);
    System.out.println(fmtExpr(op));
    assertTrue(isSolved(op));
}
Also used : Op(uk.me.parabola.mkgmap.osmstyle.eval.Op) LinkedOp(uk.me.parabola.mkgmap.osmstyle.eval.LinkedOp) Test(org.junit.Test)

Example 19 with Op

use of uk.me.parabola.mkgmap.osmstyle.eval.Op in project mkgmap by openstreetmap.

the class ExpressionArrangerTest method testComplex1.

@Test
public void testComplex1() {
    Op op = createOp("($a=2 | $b~2 | $a=2 | $a<1) & ($a!=1 | $b<2 | !($a=1) | $b=1) & $b!=1 {name 'n866'} [0x2]");
    op = arranger.arrange(op);
    assertTrue(isSolved(op));
}
Also used : Op(uk.me.parabola.mkgmap.osmstyle.eval.Op) LinkedOp(uk.me.parabola.mkgmap.osmstyle.eval.LinkedOp) Test(org.junit.Test)

Example 20 with Op

use of uk.me.parabola.mkgmap.osmstyle.eval.Op in project mkgmap by openstreetmap.

the class ExpressionArrangerTest method testPrepareOrSimple.

@Test
public void testPrepareOrSimple() {
    // Just one or
    Op op = createOp("a=3 | b < 2");
    op = arranger.arrange(op);
    Iterator<Op> it = arranger.prepareForSave(op);
    boolean first = true;
    while (it.hasNext()) {
        Op o = it.next();
        assertTrue("Prepared OR should all be LinkedOp's", o instanceof LinkedOp);
        assertEquals("Only first should have first flag set", first, ((LinkedOp) o).isFirstPart());
        first = false;
        assertTrue(isSolved(o));
        System.out.println(o);
    }
}
Also used : Op(uk.me.parabola.mkgmap.osmstyle.eval.Op) LinkedOp(uk.me.parabola.mkgmap.osmstyle.eval.LinkedOp) LinkedOp(uk.me.parabola.mkgmap.osmstyle.eval.LinkedOp) Test(org.junit.Test)

Aggregations

Op (uk.me.parabola.mkgmap.osmstyle.eval.Op)35 LinkedOp (uk.me.parabola.mkgmap.osmstyle.eval.LinkedOp)28 Test (org.junit.Test)17 EqualsOp (uk.me.parabola.mkgmap.osmstyle.eval.EqualsOp)16 ValueOp (uk.me.parabola.mkgmap.osmstyle.eval.ValueOp)16 AndOp (uk.me.parabola.mkgmap.osmstyle.eval.AndOp)12 BinaryOp (uk.me.parabola.mkgmap.osmstyle.eval.BinaryOp)12 ExistsOp (uk.me.parabola.mkgmap.osmstyle.eval.ExistsOp)12 GTEOp (uk.me.parabola.mkgmap.osmstyle.eval.GTEOp)12 LTOp (uk.me.parabola.mkgmap.osmstyle.eval.LTOp)12 NotEqualOp (uk.me.parabola.mkgmap.osmstyle.eval.NotEqualOp)12 NotExistsOp (uk.me.parabola.mkgmap.osmstyle.eval.NotExistsOp)12 OrOp (uk.me.parabola.mkgmap.osmstyle.eval.OrOp)12 RegexOp (uk.me.parabola.mkgmap.osmstyle.eval.RegexOp)12 AbstractOp (uk.me.parabola.mkgmap.osmstyle.eval.AbstractOp)11 GTOp (uk.me.parabola.mkgmap.osmstyle.eval.GTOp)9 LTEOp (uk.me.parabola.mkgmap.osmstyle.eval.LTEOp)9 NotRegexOp (uk.me.parabola.mkgmap.osmstyle.eval.NotRegexOp)9 NotOp (uk.me.parabola.mkgmap.osmstyle.eval.NotOp)7 ArrayList (java.util.ArrayList)5