mirror of
https://github.com/DanilaFe/abacus
synced 2024-11-16 07:33:09 -08:00
Write a base Graph class that does some parsing of expressions.
This commit is contained in:
parent
2e8e1488c4
commit
b0cddf75f0
33
fx/src/main/kotlin/org/nwapw/abacus/fx/graphing/Graph.kt
Normal file
33
fx/src/main/kotlin/org/nwapw/abacus/fx/graphing/Graph.kt
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
package org.nwapw.abacus.fx.graphing
|
||||||
|
|
||||||
|
import org.nwapw.abacus.Abacus
|
||||||
|
import org.nwapw.abacus.config.Configuration
|
||||||
|
import org.nwapw.abacus.number.NaiveNumber
|
||||||
|
import org.nwapw.abacus.number.NumberInterface
|
||||||
|
import org.nwapw.abacus.plugin.StandardPlugin
|
||||||
|
import org.nwapw.abacus.tree.TreeNode
|
||||||
|
|
||||||
|
class Graph(val abacus: Abacus,
|
||||||
|
expression: String, pointExpression: String,
|
||||||
|
var domain: ClosedRange<NumberInterface>, var range: ClosedRange<NumberInterface>,
|
||||||
|
var inputVariable: String = "x", var pointInputVariable: String = "n") {
|
||||||
|
|
||||||
|
private var expressionTree: TreeNode? = null
|
||||||
|
private var pointExpressionTree: TreeNode? = null
|
||||||
|
|
||||||
|
var expression: String = ""
|
||||||
|
set(value) {
|
||||||
|
expressionTree = abacus.parseString(value)
|
||||||
|
field = value
|
||||||
|
}
|
||||||
|
var pointExpression: String = ""
|
||||||
|
set(value) {
|
||||||
|
pointExpressionTree = abacus.parseString(value)
|
||||||
|
field = value
|
||||||
|
}
|
||||||
|
|
||||||
|
init {
|
||||||
|
this.expression = expression
|
||||||
|
this.pointExpression = pointExpression
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user