コード例 #1
0
  public T getChoiceVariable(int index) {

    selectedVar = select.getChoiceVariable(index);

    if (selectedVar != null) {

      currentSearchNode = new SearchNode();
      currentSearchNode.v = selectedVar;
      currentSearchNode.dom = selectedVar.dom().cloneLight();
    }

    return selectedVar;
  }
コード例 #2
0
  public boolean leftChild(T var, int value, boolean status) {

    boolean returnCode = true;

    if (exitChildListeners != null) {
      boolean code = false;
      for (int i = 0; i < exitChildListeners.length; i++)
        code |= exitChildListeners[i].leftChild(var, value, status);
      returnCode = code;
    }

    currentSearchNode = searchStack.pop();
    SearchNode previousSearchNode = currentSearchNode;

    if (!status && returnCode) {

      currentSearchNode = new SearchNode();
      currentSearchNode.v = var;

      if (previousSearchNode.dom
          instanceof uk.ac.stir.cs.homer.homerPolicyServer.overlap.JaCoP.core.IntDomain)
        currentSearchNode.dom = ((IntDomain) previousSearchNode.dom).subtract(value);
      else if (previousSearchNode.dom
          instanceof uk.ac.stir.cs.homer.homerPolicyServer.overlap.JaCoP.set.core.SetDomain)
        currentSearchNode.dom = ((SetDomain) previousSearchNode.dom).subtract(value, value);

      currentSearchNode.val = value;
      currentSearchNode.id = searchNodeId++;
      currentSearchNode.equal = false;
      currentSearchNode.previous = searchStack.peek().id;

      searchStack.push(currentSearchNode);
    }

    return returnCode;
  }