2017-07-26 10:58:27 -07:00
|
|
|
package org.nwapw.abacus.tree;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Interface used to reduce a tree into a single value.
|
2017-07-30 21:11:32 -07:00
|
|
|
*
|
2017-07-26 10:58:27 -07:00
|
|
|
* @param <T> the value to reduce into.
|
|
|
|
*/
|
|
|
|
public interface Reducer<T> {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reduces the given tree into a single value of type T.
|
2017-07-30 21:11:32 -07:00
|
|
|
*
|
|
|
|
* @param node the node being passed in to be reduced.
|
2017-07-26 10:58:27 -07:00
|
|
|
* @param children the already-reduced children of this node.
|
|
|
|
* @return the resulting value from the reduce.
|
|
|
|
*/
|
2017-07-30 21:11:32 -07:00
|
|
|
public T reduceNode(TreeNode node, Object... children);
|
2017-07-26 10:58:27 -07:00
|
|
|
|
|
|
|
}
|