/* The main tree traversal function; if node is a leaf, * return classification; otherwise, determine whether * instance is higher or lower than this attribute-value * pair and returns testInstance of proper child */ public boolean testInstance(Instance in) { if (majority) { return majClass; } if (leaf) { return classification; } else { if (in.get((int) attribute) <= value) { return leftChild.testInstance(in); } else { return rightChild.testInstance(in); } } }