-3
我不明白我的程序何時讀取我的yml文件,它讀取float的類型,但它返回零或0.0。我有我的浮動TRIG_EDGE_LEV返回0.0,但它應該返回1.5。java:返回null或0.0
public class Loadyml {
//static OscilloDSO1072B dso1072B = new OscilloDSO1072B("visa://192.168.53.67/USB0::0x0957::0x0588::CN55040484::INSTR") ;
private String TRIG_EDGE_SLOP;
private String ENABLE_CHAN_OFFSET;
private float TRIG_EDGE_LEV;
private String TIM_MODE;
private String SCALE_NUMBER;
private String TIM_MAIN_SCAL;
private String SCALE_CHAN;
private String TRIG_EDGE_SOURCE;
private String WAV_SOUR;
private String PROB_CHAN;
private String INVERSE_CHAN;
private String WAV_POINT_MODE;
private String DISPLAY_CHAN;
private String ENABLE_CHAN_BWL_OFF;
private String COUPLING_CHAN;
private String OFFSET_NUMBER;
private String WAV_FORM;
public String getTRIG_EDGE_SLOP() {
return TRIG_EDGE_SLOP;
}
public void setTRIG_EDGE_SLOP(String TRIG_EDGE_SLOP) {
this.TRIG_EDGE_SLOP = TRIG_EDGE_SLOP;
}
public String getENABLE_CHAN_OFFSET() {
return ENABLE_CHAN_OFFSET;
}
public void setENABLE_CHAN_OFFSET(String ENABLE_CHAN_OFFSET) {
this.ENABLE_CHAN_OFFSET = ENABLE_CHAN_OFFSET;
}
public float getTRIG_EDGE_LEV() {
return TRIG_EDGE_LEV;
}
public void setTRIG_EDGE_LEV(float TRIG_EDGE_LEV) {
this.TRIG_EDGE_LEV = TRIG_EDGE_LEV;
}
public String getTIM_MODE() {
return TIM_MODE;
}
public void setTIM_MODE(String TIM_MODE) {
this.TIM_MODE = TIM_MODE;
}
public String getSCALE_NUMBER() {
return SCALE_NUMBER;
}
public void setSCALE_NUMBER(String SCALE_NUMBER) {
this.SCALE_NUMBER = SCALE_NUMBER;
}
public String getTIM_MAIN_SCAL() {
return TIM_MAIN_SCAL;
}
public void setTIM_MAIN_SCAL(String TIM_MAIN_SCAL) {
this.TIM_MAIN_SCAL = TIM_MAIN_SCAL;
}
public String getSCALE_CHAN() {
return SCALE_CHAN;
}
public void setSCALE_CHAN(String SCALE_CHAN) {
this.SCALE_CHAN = SCALE_CHAN;
}
public String getTRIG_EDGE_SOURCE() {
return TRIG_EDGE_SOURCE;
}
public void setTRIG_EDGE_SOURCE(String TRIG_EDGE_SOURCE) {
this.TRIG_EDGE_SOURCE = TRIG_EDGE_SOURCE;
}
public String getWAV_SOUR() {
return WAV_SOUR;
}
public void setWAV_SOUR(String WAV_SOUR) {
this.WAV_SOUR = WAV_SOUR;
}
public String getPROB_CHAN() {
return PROB_CHAN;
}
public void setPROB_CHAN(String PROB_CHAN) {
this.PROB_CHAN = PROB_CHAN;
}
public String getINVERSE_CHAN() {
return INVERSE_CHAN;
}
public void setINVERSE_CHAN(String INVERSE_CHAN) {
this.INVERSE_CHAN = INVERSE_CHAN;
}
public String getWAV_POINT_MODE() {
return WAV_POINT_MODE;
}
public void setWAV_POINT_MODE(String WAV_POINT_MODE) {
this.WAV_POINT_MODE = WAV_POINT_MODE;
}
public String getDISPLAY_CHAN() {
return DISPLAY_CHAN;
}
public void setDISPLAY_CHAN(String DISPLAY_CHAN) {
this.DISPLAY_CHAN = DISPLAY_CHAN;
}
public String getENABLE_CHAN_BWL_OFF() {
return ENABLE_CHAN_BWL_OFF;
}
public void setENABLE_CHAN_BWL_OFF(String ENABLE_CHAN_BWL_OFF) {
this.ENABLE_CHAN_BWL_OFF = ENABLE_CHAN_BWL_OFF;
}
public String getCOUPLING_CHAN() {
return COUPLING_CHAN;
}
public void setCOUPLING_CHAN(String COUPLING_CHAN) {
this.COUPLING_CHAN = COUPLING_CHAN;
}
public String getOFFSET_NUMBER() {
return OFFSET_NUMBER;
}
public void setOFFSET_NUMBER(String OFFSET_NUMBER) {
this.OFFSET_NUMBER = OFFSET_NUMBER;
}
public String getWAV_FORM() {
return WAV_FORM;
}
public void setWAV_FORM(String WAV_FORM) {
this.WAV_FORM = WAV_FORM;
}
public void Loadfichier() throws FileNotFoundException{
try {
System.out.println(Yaml.loadType(new File("config.yml"), Loadyml.class));
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public String toString() {
//dso1072B.setchanconftest(commande);
// Float.parseFloat(SCALE_NUMBER);
return "[Commande SCPI='"+WAV_FORM+","+ENABLE_CHAN_BWL_OFF+""
+ ","+TRIG_EDGE_LEV+","+TIM_MODE+""
+ ","+SCALE_NUMBER+","+TRIG_EDGE_SLOP+""
+ ","+DISPLAY_CHAN+","+TIM_MAIN_SCAL+""
+ ","+SCALE_CHAN+","+TRIG_EDGE_SOURCE+""
+ ","+WAV_SOUR+","+INVERSE_CHAN+""
+ ","+PROB_CHAN+","+WAV_POINT_MODE+""
+ ","+ENABLE_CHAN_OFFSET+","+COUPLING_CHAN+""
+ ","+OFFSET_NUMBER+"']";
}
}
我該如何解決這個問題?
請構建[最少測試用例(HTTP ://stackoverflow.com/help/mcve),並將輸出**直接發佈到你的問題:) –