mirror of
https://github.com/DanilaFe/abacus
synced 2026-02-01 03:25:19 +00:00
Format code.
This commit is contained in:
@@ -36,7 +36,7 @@ data class FunctionNode(val function: String) : TreeNode() {
|
||||
*
|
||||
* @node the node to append.
|
||||
*/
|
||||
fun appendChild(node: TreeNode){
|
||||
fun appendChild(node: TreeNode) {
|
||||
children.add(node)
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ data class FunctionNode(val function: String) : TreeNode() {
|
||||
*
|
||||
* @node the node to prepend.
|
||||
*/
|
||||
fun prependChild(node: TreeNode){
|
||||
fun prependChild(node: TreeNode) {
|
||||
children.add(0, node)
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ package org.nwapw.abacus.tree
|
||||
* The reducer walks the tree, visiting the children first, converting them into
|
||||
* a value, and then attempts to reduce the parent. Eventually, the single final value is returned.
|
||||
*/
|
||||
interface Reducer <out T> {
|
||||
interface Reducer<out T> {
|
||||
|
||||
/**
|
||||
* Reduces the given tree node, given its already reduced children.
|
||||
@@ -14,6 +14,6 @@ interface Reducer <out T> {
|
||||
* @param treeNode the tree node to reduce.
|
||||
* @param children the list of children, of type T.
|
||||
*/
|
||||
fun reduceNode(treeNode: TreeNode, vararg children: Any) : T?
|
||||
fun reduceNode(treeNode: TreeNode, vararg children: Any): T?
|
||||
|
||||
}
|
||||
@@ -5,6 +5,6 @@ package org.nwapw.abacus.tree
|
||||
*/
|
||||
abstract class TreeNode {
|
||||
|
||||
abstract fun <T: Any> reduce(reducer: Reducer<T>) : T?
|
||||
abstract fun <T : Any> reduce(reducer: Reducer<T>): T?
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user