1
0
mirror of https://github.com/DanilaFe/abacus synced 2024-06-30 14:50:59 -07:00
Abacus/core/src/main/kotlin/org/nwapw/abacus/tree/nodes/TreeValueBinaryNode.kt

23 lines
675 B
Kotlin
Raw Normal View History

package org.nwapw.abacus.tree.nodes
import org.nwapw.abacus.tree.Reducer
/**
* A tree node that represents a binary tree value operator.
*
*
* The tree value operators operate on trees, and so this
* node does not reduce its children. It is up to the implementation to handle
* reduction.
* @param operation the operation this node performs.
* @param left the left child of this node.
* @param right the right child of this node.
*/
2017-09-07 12:31:40 -07:00
class TreeValueBinaryNode(operation: String, left: TreeNode, right: TreeNode)
: BinaryNode(operation, left, right) {
2017-09-07 12:53:12 -07:00
override fun <T : Any> reduce(reducer: Reducer<T>): T {
return reducer.reduceNode(this)
}
}