1
0
mirror of https://github.com/DanilaFe/abacus synced 2024-06-30 06:40:58 -07:00
Abacus/core/src/main/kotlin/org/nwapw/abacus/tree/VariableNode.kt

21 lines
541 B
Kotlin
Raw Normal View History

2017-08-18 14:20:49 -07:00
package org.nwapw.abacus.tree
/**
* A tree node that holds a placeholder variable.
*
* This node holds a variable string, and acts similarly to a number,
* with the key difference of not actually holding a value at runtime.
*
* @param variable the actual variable name that this node represents.
*/
class VariableNode(val variable: String) : TreeNode() {
2017-08-18 14:20:49 -07:00
2017-09-07 12:53:12 -07:00
override fun <T : Any> reduce(reducer: Reducer<T>): T {
2017-08-18 14:20:49 -07:00
return reducer.reduceNode(this)
}
override fun toString(): String {
return variable
}
}