如何查看其他三個對象屬性?我需要檢查每個三個屬性是否不等於null,然後對每個三個語句執行一些操作。很多if語句
if(current.getValue()>0)
{
serie = fChart
.createSeries()
.setName(current.getLabel())
.setPoints(
new Number[]{
{t.getTime(),
current.getValue()}
Chart.addSeries(serie);
我需要檢查它在接下來的兩個語句,
if(current1.getValue()>0)
then do something for the serie1, and
if(current2.getValue()>0)
then do something for the serie2
我想它來寫,如:
if (current.getValue() > 0) {
serie = fChart
.createSeries()
.setName(current.getLabel())
.setPoints(
new Number[] {
{
t.getTime(),
current.getValue() }
Chart.addSeries(serie);
}
if (current1.getValue() > 0) {
serie1 = fChart
.createSeries()
.setName(current.getLabel1())
.setPoints(
new Number[] {
{t.getTime(),
current1.getValue1() }
Chart.addSeries(serie1);
}
if (current2.getValue() > 0) {
serie2 = fChart
.createSeries()
.setName(current.getLabel2())
.setPoints(
new Number[] {
{t.getTime(),
current2.getValue2() }
Chart.addSeries(serie2);
}
但它不似乎工作,有什麼建議?
請修復縮進。 – 2014-10-07 12:31:17
請格式化此代碼... – 2014-10-07 12:32:05
'但它似乎並不工作'什麼是問題? – Brandon 2014-10-07 12:33:01