1
0
mirror of https://github.com/DanilaFe/abacus synced 2026-01-28 09:35:19 +00:00

Implement the ability to reduce a tree to a single variable of a type.

This commit is contained in:
2017-07-26 10:58:27 -07:00
parent ac153521d4
commit 798ee6f7c3
4 changed files with 33 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
package org.nwapw.abacus.tree;
/**
* Interface used to reduce a tree into a single value.
* @param <T> the value to reduce into.
*/
public interface Reducer<T> {
/**
* Reduces the given tree into a single value of type T.
* @param node the node being passed in to be reduced.
* @param children the already-reduced children of this node.
* @return the resulting value from the reduce.
*/
public T reduceNode(TreeNode node, Object...children);
}