Skip to content

Instantly share code, notes, and snippets.

@Test
public void testOperatorWithoutSpace() {
String str = "length == ($c.length -1)"; // only works with a space after the minus operator
ParserConfiguration pconf = new ParserConfiguration();
ParserContext pctx = new ParserContext(pconf);
ExecutableStatement stmt = (ExecutableStatement) MVEL.compileExpression(str, pctx);
Column col1 = new Column("x",0);
Column col2 = new Column("x", 0);
Map<String, Object> vars = new HashMap<String, Object> ();
rule xxx
$b : Bird()
then
insertLogical( new Fly( $b ), PLUS );
end
rule yyy
$b : Bird(weight>1000)
then
2013-02-14 05:44:03,983 [main] TRACE Insert [fact 0:0:472732980:1306428912:0:DEFAULT:org.drools.reteoo.InitialFactImpl@4dde85f0]
2013-02-14 05:44:03,988 [main] TRACE LinkNode notify=true nmask=1 smask=1 spos=0 rules=
2013-02-14 05:44:03,990 [main] TRACE LinkNode notify=true nmask=1 smask=1 spos=0 rules="existsBlah" "notBlah" "init"
2013-02-14 05:44:03,990 [main] TRACE LinkSegment smask=1 rmask=0 name=existsBlah
2013-02-14 05:44:03,990 [main] TRACE LinkSegment smask=1 rmask=0 name=notBlah
2013-02-14 05:44:03,990 [main] TRACE LinkSegment smask=1 rmask=0 name=init
2013-02-14 05:44:03,991 [main] TRACE LinkRule name=init
2013-02-14 05:44:03,997 [main] TRACE Insert [fact 0:1:2134042896:-1699558022:1:DEFAULT:[Person name='null age='0' likes='lamp']]
2013-02-14 05:44:04,004 [main] TRACE LinkNode notify=true nmask=2 smask=2 spos=0 rules="go7"
2013-02-14 05:44:04,005 [main] TRACE LinkNode notify=true nmask=1 smask=1 spos=0 rules="look"
@mdproctor
mdproctor / gist:7853901
Last active December 30, 2015 16:19
simple DRL DSL
package org.drools.java8;
import java.util.List;
import java.util.ArrayList;
import java.util.function.Predicate;
public class Java8Example {
Rule rule1 = new Rule()
.setWhen((CTuple1<Person>) (Person person) -> person.getAge() >= 18,
package org.drools.compiler.simulation;
import org.drools.compiler.Message;
import org.drools.core.command.RequestContextImpl;
import org.drools.core.fluent.impl.FluentBuilderImpl;
import org.drools.core.fluent.impl.PsuedoClockRunner;
import org.kie.internal.fluent.runtime.FluentBuilder;
import org.junit.Test;
import org.kie.api.KieServices;
import org.kie.api.builder.KieModule;
String a = code("import jsinterop.annotations.JsType;import jsinterop.annotations.JsMethod;import jsinterop.annotations.JsProperty;",
"public class A {",
" public void foo() {}",
"}");
String b = code("import jsinterop.annotations.JsType;import jsinterop.annotations.JsMethod;import jsinterop.annotations.JsProperty;",
"public class B extends A{",
"}");
String c = code("import jsinterop.annotations.JsType;import jsinterop.annotations.JsMethod;import jsinterop.annotations.JsProperty;",
@Test
public void testABC() throws IOException {
String a = code("import jsinterop.annotations.JsType;import jsinterop.annotations.JsMethod;import jsinterop.annotations.JsProperty;",
"public class A {",
" public A a = new A();",
" public void foo() {}",
" @JsMethod\n",
" public static native String goodbyeWorld();",
"}");
test/A.java
test.A
/var/folders/0b/54kqd29n7lq70q_9c9tyl2h40000gn/T/tester442413923107770649/input/test/A.java
/var/folders/0b/54kqd29n7lq70q_9c9tyl2h40000gn/T/tester442413923107770649/input/test/A.native_js
- extend/impl
- deps
- src
test/B.java
test.B
A.build.map
- sources
A
A.java
/private/var/tmp/_bazel_mdproctor/94fe6331e7827fec37a32e75ce5a85ba/execroot/com_google_j2cl/_tmp/cb3001ce7e843c32a8bd751b1c8155d6/transpile_tester94239387860308966/input/A.java
A.native.js
- interfaces
I1.java
- dependencies
package net.cardosi.mojo;
import java.io.File;
import java.lang.reflect.Method;
import java.nio.file.Files;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import org.apache.maven.DefaultMaven;