java
으로 작성된이 간단한 코드가 있습니다. 이 거기에 내가 CHECK_BOX_CALIB_METH
라는 이름의 객체를 생성 한 KmaxJava에서 메소드를 호출 할 때 식별자가 예상되는 오류
import kmax.ext.*;
public class Runtime implements KmaxRuntime {
KmaxToolsheet tlsh; // Store a reference to the toolsheet environment
KmaxHist hist1D;
KmaxWidget checkBoxWidget;
public void init(KmaxToolsheet toolsheet) {
tlsh = toolsheet; // Save this reference for use in the toolsheet
hist1D = tlsh.getKmaxHist("HIST1D");
checkBoxWidget = tlsh.getKmaxWidget("CHECK_BOX_CALIB_METH");
tlsh.getKmaxWidget("CHECK_BOX_CALIB_METH").setProperty("VALUE", "1");
}
public void CalibInit(KmaxWidget widget, KmaxHist histo){
histo.setUseXAxisCalibration(stringToBool(widget.getProperty("VALUE")));
histo.update();
}
CalibInit(checkboxWidget,hist1D);
public void GO(KmaxToolsheet toolsheet){}
public void SRQ(KmaxDevice device) {}
public void HALT(KmaxToolsheet toolsheet) {}
} // End of the Runtime object
주의라고하는 DAQ 프레임 워크에서 실제로. 이 코드를 컴파일 할 때 나는 내가 CalibInit
방법을 제거하고
public void CHECK_BOX_CALIB_METH(KmaxWidget widget) {
hist1D.setUseXAxisCalibration(stringToBool(widget.getProperty("VALUE")));
hist1D.update();
}
로 교체하면 내가 더 컴파일 오류가 없다는 것을 이러한 오류 메시지
compiler msg>error: invalid method declaration; return type required
compiler msg> CalibInit(checkboxWidget,hist1D);
compiler msg> ^
compiler msg>error: <identifier> expected
compiler msg>CalibInit(checkboxWidget,hist1D);
compiler msg> ^
compiler msg>error: <identifier> expected
compiler msg>CalibInit(checkboxWidget,hist1D);
compiler msg> ^
주를 얻는다. 키포인트는 메소드의 이름이 객체의 이름과 동일하다는 것입니다. 내가 CalibInit()
을 만든 이유는 동일한 기능을 가진 동일한 유형의 모든 객체에 대해 각 메소드를 사용하지 않기 위해서입니다. 주위에 방법이 있습니까?
이러한 오류를 방지하려면 어떻게해야합니까?
도움 주셔서 대단히 감사합니다! – Thanos