1. public void constructKnowIt(FormulaNode f, KnowIt self) {
  2.  
  3. // if the FormulaNode is a node
  4. if (f.getType() == 0) {
  5.  
  6. KnowIt left = new KnowIt("left", "boolean");
  7. KnowIt right = new KnowIt("right", "boolean");
  8.  
  9. self.addParameter(left);
  10. self.addParameter(right);
  11. self.bind(new DoIt(f.getOperation()));
  12.  
  13. constructKnowIt(f.getLeftNode(), left);
  14. constructKnowIt(f.getRightNode(), right);
  15.  
  16. // otherwise it is a variable
  17. } else {
  18.  
  19. KnowIt bool = new KnowIt(f.getVariableName(), "boolean");
  20. bool.bind(createTrue());
  21.  
  22. self.bind(bool);
  23. }
  24. }