2017-07-25 14:21:00 -07:00
|
|
|
package org.nwapw.abacus.tree;
|
|
|
|
|
|
|
|
import org.nwapw.abacus.number.NaiveNumber;
|
2017-07-25 14:26:31 -07:00
|
|
|
import org.nwapw.abacus.number.NumberInterface;
|
2017-07-25 14:21:00 -07:00
|
|
|
|
|
|
|
public class NumberNode extends TreeNode {
|
|
|
|
|
2017-07-25 14:26:31 -07:00
|
|
|
private NumberInterface number;
|
2017-07-25 14:21:00 -07:00
|
|
|
|
|
|
|
public NumberNode(){
|
|
|
|
number = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
public NumberNode(double value){
|
|
|
|
number = new NaiveNumber(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
public NumberNode(String value){
|
|
|
|
this(Double.parseDouble(value));
|
|
|
|
}
|
|
|
|
|
2017-07-25 14:26:31 -07:00
|
|
|
public NumberInterface getNumber() {
|
2017-07-25 14:21:00 -07:00
|
|
|
return number;
|
|
|
|
}
|
|
|
|
}
|