📄 clipsjniexample.java
字号:
import CLIPSJNI.*;public class CLIPSJNIExample { public static void main(String[] args) { Environment env; Router theOutput; env = new Environment(); theOutput = new Router("java"); env.addRouter(theOutput); /* env.build("(deftemplate person (slot name) (multislot friends))"); FactAddressValue theFact = env.assertString("(person (name Fred) (friends Sue Bill Bob))"); System.out.println("name slot = " + theFact.getFactSlot("name")); System.out.println("friends slot = " + theFact.getFactSlot("friends")); */ env.build("(defclass person (is-a USER) (slot fname) (multislot friends))"); InstanceAddressValue theInstance = env.makeInstance("(of person (fname Fred) (friends Sue Bill Bob))"); System.out.println("instance = " + theInstance); System.out.println("name slot = " + theInstance.directGetSlot("fname")); System.out.println("friends slot = " + theInstance.directGetSlot("friends")); /* PrimitiveValue theValue = env.eval("3"); System.out.println("theValue = " + theValue.toString()); theValue = env.eval("(create$ a b c)"); System.out.println("theValue = " + theValue.toString()); theValue = env.eval("(str-cat red 7)"); System.out.println("theValue = " + theValue.toString()); theValue = env.eval("(sym-cat blue 3)"); System.out.println("theValue = " + theValue.toString()); */ /* env.eval("(facts)"); */ /* env.load("auto.clp"); env.reset(); env.run(); */ /* env.eval("(printout t \"Hello World!\" crlf)"); System.out.println("(+ 123456789000000000 123456789) = " + env.eval("(+ 123456789000000000 123456789)")); System.out.println("(* 3.1 7.3) = " + env.eval("(* 3.1 7.3)")); System.out.println("(sym-cat a b) = " + env.eval("(sym-cat a b)")); System.out.println("(str-cat a b) = " + env.eval("(str-cat a b)")); System.out.println("(symbol-to-instance-name a) = " + env.eval("(symbol-to-instance-name a)")); System.out.println("(facts) = " + env.eval("(facts)")); System.out.println("(create$ a \"z\" 3 8.7) = " + env.eval("(create$ a \"z\" 3 8.7)")); System.out.println("(assert (x y z)) = " + env.eval("(assert (x y z))")); FactAddressValue theFact; theFact = env.assertString("(x y z)"); System.out.println("the Fact = " + theFact); */ } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -