コード例 #1
0
  static RandomIntegerWorkspaceObject load(Node node) throws ProgramLoadingException {
    if (!node.getNodeName().equals("randint")) throw new ProgramLoadingException();

    RandomIntegerWorkspaceObject obj = new RandomIntegerWorkspaceObject(Workspace.getWorkspace());

    Node subNode = Workspace.getNthChildElement(node, 0);
    if (subNode != null) {
      WorkspaceObject wsObj = Workspace.dispatchLoad(subNode);
      if (wsObj != null) {
        obj.sink.progCombine(wsObj);
      }
    }
    return obj;
  }
コード例 #2
0
  static DivisionOperatorWorkspaceObject load(Node node) throws ProgramLoadingException {
    if (!node.getNodeName().equals("division")) throw new ProgramLoadingException();

    DivisionOperatorWorkspaceObject obj =
        new DivisionOperatorWorkspaceObject(Workspace.getWorkspace());
    Node lop = Workspace.getChildElementByName(node, "loperand");
    Node rop = Workspace.getChildElementByName(node, "roperand");

    if (lop != null) {
      Node lopNode = Workspace.getNthChildElement(lop, 0);
      if (lopNode != null) {
        WorkspaceObject lopObj = Workspace.dispatchLoad(lopNode);
        if (lopObj != null) {
          obj.leftSink.progCombine(lopObj);
        }
      }
    }

    if (rop != null) {
      Node ropNode = Workspace.getNthChildElement(rop, 0);
      if (ropNode != null) {
        WorkspaceObject ropObj = Workspace.dispatchLoad(ropNode);
        if (ropObj != null) {
          obj.rightSink.progCombine(ropObj);
        }
      }
    }

    return obj;
  }