⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 echosolver.java

📁 SRI international 发布的OAA框架软件
💻 JAVA
字号:
/*
 * Created on Jan 5, 2004
 *
 */
package com.sri.oaa2.test.basic;

import com.sri.oaa2.com.LibCom;
import com.sri.oaa2.com.LibComTcpProtocol;
import com.sri.oaa2.icl.IclList;
import com.sri.oaa2.icl.IclTerm;
import com.sri.oaa2.lib.LibOaa;
import com.sri.oaa2.lib.OAAEventListener;

/**
 * @author agno
 *
 */
public class EchoSolver
{
  private LibOaa oaa_;
  
  public void init()
  {
    LibCom com = new LibCom(new LibComTcpProtocol(), null);
    oaa_ = new LibOaa(com);
    if(!oaa_.getComLib().comConnect("parent", IclTerm.fromString(true, "tcp(Host,Port)"), new IclList())) {
      throw new RuntimeException("Could not connect to parent");
    }

    oaa_.oaaRegisterCallback("oaa_AppDoEvent",
        new OAAEventListener() {
      public boolean doOAAEvent(IclTerm goal,
          IclList params,
          IclList answers) 
      {
        return(processMessage(goal, params, answers));
      }
    }
    );
    
    
    if(!oaa_.oaaRegister("parent", "EchoSolver", new IclList(IclTerm.fromString(true, "echo(X,Y)")), new IclList())) {
      throw new RuntimeException("Could not register echo solvable");
    }
    
    oaa_.oaaReady(true);
  }
  
  public boolean processMessage(IclTerm goal, IclList params, IclList answers)
  {
    System.out.println("Got goal " + goal.toString());
    answers.add(goal);
    return true;
  }
  
  public static void main(String[] args) throws InterruptedException
  {
    EchoSolver es = new EchoSolver();
    es.init();
    while(true) {
      Thread.sleep(10000);
    }
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -