private String genStr(BioFuzzParseNode node, int level) { String s = ""; List<BioFuzzParseNode> children = null; // if ((children = node.getChildren()) != null) { if (node.hasChildren()) { children = node.getChildren(); assert (children != null); Iterator<BioFuzzParseNode> iter = children.iterator(); while (iter.hasNext()) { BioFuzzParseNode child = iter.next(); s += StringUtils.repeat(" ", level) + "|--" + child.toString(); s += "[AttackTag: " + child.getAtagName() + "(" + child.getAtagType().toString() + ")" + "(" + child.getVal() + ")]\n" + genStr(child, level + 1); } } else { if (this.tokLst != null) { s += StringUtils.repeat(" ", level) + "|--" + node.toString(); s += "[Tok: " + this.tokLst.get(node.getTokIdx()) + "(" + node.getAtagType().toString() + ")" + "(" + node.getVal() + ")]\n"; } } // } return s; }
/** Recursively determines all non-terminal nodes. */ private void resetNtSet(BioFuzzParseNode node) { assert (node != null); BioFuzzAttackTag atag = node.getAtag(); assert (atag != null); if ((atag.getTagType() == TagType.ROOT || atag.getTagType() == TagType.NON_TERMINAL) && node.getVal()) { addNtElem(node.getAtagName(), node); } assert (node.getChildren() != null); for (BioFuzzParseNode child : node.getChildren()) { resetNtSet(child); } }