Example #1
0
 /**
  * traverse graph and test all categories found in leaf nodes for shadows
  *
  * @param node
  */
 void shadowChecker(Nodemapper node) {
   if (NodemapperOperator.isLeaf(node)) {
     String input = node.category.getPattern();
     input = brain.replaceBotProperties(input);
     input = input.replace("*", "XXX").replace("_", "XXX").replace("^", "").replace("#", "");
     String that =
         node.category
             .getThat()
             .replace("*", "XXX")
             .replace("_", "XXX")
             .replace("^", "")
             .replace("#", "");
     String topic =
         node.category
             .getTopic()
             .replace("*", "XXX")
             .replace("_", "XXX")
             .replace("^", "")
             .replace("#", "");
     input = instantiateSets(input);
     System.out.println("shadowChecker: input=" + input);
     Nodemapper match = brain.match(input, that, topic);
     if (match != node) {
       System.out.println("" + Graphmaster.inputThatTopic(input, that, topic));
       System.out.println("MATCHED:     " + match.category.inputThatTopic());
       System.out.println("SHOULD MATCH:" + node.category.inputThatTopic());
     }
   } else {
     for (String key : NodemapperOperator.keySet(node)) {
       shadowChecker(NodemapperOperator.get(node, key));
     }
   }
 }