mirror of
https://github.com/DanilaFe/abacus
synced 2024-11-17 08:03:09 -08:00
Remove data modifier from tree classes.
This commit is contained in:
parent
ac19c7b230
commit
c5cd0f81ad
|
@ -11,7 +11,7 @@ package org.nwapw.abacus.tree
|
|||
* @param left the left node.
|
||||
* @param right the right node.
|
||||
*/
|
||||
data class BinaryNode(val operation: String, val left: TreeNode? = null, val right: TreeNode?) : TreeNode() {
|
||||
class BinaryNode(val operation: String, val left: TreeNode? = null, val right: TreeNode?) : TreeNode() {
|
||||
|
||||
override fun <T : Any> reduce(reducer: Reducer<T>): T? {
|
||||
val leftReduce = left?.reduce(reducer) ?: return null
|
||||
|
|
|
@ -8,7 +8,7 @@ package org.nwapw.abacus.tree
|
|||
*
|
||||
* @param function the function string.
|
||||
*/
|
||||
data class FunctionNode(val function: String) : TreeNode() {
|
||||
class FunctionNode(val function: String) : TreeNode() {
|
||||
|
||||
/**
|
||||
* List of function parameters added to this node.
|
||||
|
|
|
@ -10,7 +10,7 @@ import org.nwapw.abacus.number.NumberInterface
|
|||
*
|
||||
* @number the number value of this node.
|
||||
*/
|
||||
data class NumberNode(val number: String) : TreeNode() {
|
||||
class NumberNode(val number: String) : TreeNode() {
|
||||
|
||||
override fun <T : Any> reduce(reducer: Reducer<T>): T? {
|
||||
return reducer.reduceNode(this)
|
||||
|
|
|
@ -9,7 +9,7 @@ package org.nwapw.abacus.tree
|
|||
* @param operation the operation applied to the given node.
|
||||
* @param applyTo the node to which the operation will be applied.
|
||||
*/
|
||||
data class UnaryNode(val operation: String, val applyTo: TreeNode? = null) : TreeNode() {
|
||||
class UnaryNode(val operation: String, val applyTo: TreeNode? = null) : TreeNode() {
|
||||
|
||||
override fun <T : Any> reduce(reducer: Reducer<T>): T? {
|
||||
val reducedChild = applyTo?.reduce(reducer) ?: return null
|
||||
|
|
|
@ -8,7 +8,7 @@ package org.nwapw.abacus.tree
|
|||
*
|
||||
* @param variable the actual variable name that this node represents.
|
||||
*/
|
||||
data class VariableNode(val variable: String) : TreeNode() {
|
||||
class VariableNode(val variable: String) : TreeNode() {
|
||||
|
||||
override fun <T : Any> reduce(reducer: Reducer<T>): T? {
|
||||
return reducer.reduceNode(this)
|
||||
|
|
Loading…
Reference in New Issue
Block a user