嘿,我目前正在尝试做的是功能绘图仪。要做到这一点,我想要一个类函数,到目前为止看起来像这样:
public class Function implements IFunction{
private C instruction; //C is a placeholder for the answer to my question
public Function(C instruction){
this.instruction = instruction;//Instructions is supposed to be
} //something that tells the programm hot
@Override //calculate Y from x.
public double getY(double x) {
return this.instruction(x) //using the instructions
}
我现在的问题是,我可以使用哪种数据结构来表示我的说明。因为函数可以具有从y = sin(x)到y = x的所有类型的指令,并且我希望能够为每个函数分配拟合指令。
感谢任何帮助