1
0
mirror of https://github.com/DanilaFe/abacus synced 2026-01-31 19:15:20 +00:00

Make applicable into an interface.

This commit is contained in:
2017-08-25 15:42:10 -07:00
parent da1c78945e
commit 8a3c614602
8 changed files with 70 additions and 68 deletions

View File

@@ -8,4 +8,4 @@ import org.nwapw.abacus.number.NumberInterface
* This function takes some number of input NumberInterfaces and returns
* another NumberInterface as a result.
*/
abstract class NumberFunction : Applicable<NumberInterface, NumberInterface>()
abstract class NumberFunction : Applicable<NumberInterface, NumberInterface>

View File

@@ -12,4 +12,5 @@ import org.nwapw.abacus.number.NumberInterface
*/
abstract class NumberOperator(associativity: OperatorAssociativity, type: OperatorType,
precedence: Int) :
Operator<NumberInterface, NumberInterface>(associativity, type, precedence)
Operator(associativity, type, precedence),
Applicable<NumberInterface, NumberInterface>

View File

@@ -9,5 +9,5 @@ package org.nwapw.abacus.function
* @param type the type of this operator, used for parsing (infix / prefix / postfix and binary / unary)
* @param precedence the precedence of this operator, used for order of operations.
*/
abstract class Operator<T: Any, O: Any>(val associativity: OperatorAssociativity, val type: OperatorType,
val precedence: Int) : Applicable<T, O>()
open class Operator(val associativity: OperatorAssociativity, val type: OperatorType,
val precedence: Int)

View File

@@ -9,4 +9,4 @@ import org.nwapw.abacus.tree.TreeNode
* A function that operates on parse tree nodes instead of on already simplified numbers.
* Despite this, it returns a number, not a tree.
*/
abstract class TreeValueFunction : ReducerApplicable<TreeNode, NumberInterface, NumberInterface>()
abstract class TreeValueFunction : ReducerApplicable<TreeNode, NumberInterface, NumberInterface>