Problema com método estático

0 respostas
L

Pessoal, estou tendo problemas com o método estático do JFreeChart.
Segue o código:

public class capabilidade {

    //Declaração das variáveis globais
    private List<Double> x1,y1,x2,y2,x3,y3,cont_x,cont_y, fp_x, fp_y;
    private String fileName, tpPolo;
    private double fp;

    public capabilidade() {
        fp = 0;
    }

    private void leCapabilidade(String FileName) {
       try {
          fileName = FileName;
          boolean fileexists = (new File(FileName)).exists();
          if (fileexists) {
             InputStream   is = new FileInputStream(FileName);
             Scanner entrada = new Scanner(is);
             x1 = new ArrayList<Double>();
             y1 = new ArrayList<Double>();
             x2 = new ArrayList<Double>();
             y2 = new ArrayList<Double>();
             x3 = new ArrayList<Double>();
             y3 = new ArrayList<Double>();
             double x_temp, y_temp;

             String str;
             int count;
             count = 1;
             while (entrada.hasNextLine())
             {
                str = entrada.nextLine().trim();

                if (str.length() < 1)  count++;
                else
                {
                    x_temp = Double.parseDouble(str.substring(0,8).trim());
                    y_temp = Double.parseDouble(str.substring(9,str.length()).trim());

                    if (count == 1)
                    {
                        x1.add(x_temp);
                        y1.add(y_temp);
                    }
                    if (count == 2)
                    {
                        x2.add(x_temp);
                        y2.add(y_temp);
                    }
                    if (count == 3)
                    {
                        x3.add(x_temp);
                        y3.add(y_temp);
                    }
                }

             }
              is.close();
          }
       } catch (IOException e) {}
    }

{...}

   private static XYDataset cap()
    {
        capabilidade dadosCap = new capabilidade();

        XYSeries s2 = new XYSeries("Tensão Nominal");

        for(int i=0;i<dadosCap.x2.size();i++)
        {
            s2.add(dadosCap.x2.get(i),dadosCap.y2.get(i));
        }

        XYSeriesCollection dataset = new XYSeriesCollection();
        dataset.addSeries(s2);

        return dataset;
    }
Estou tendo problemas para recuperar o valor de x2 e y2 dentro do método
private static XYDataset cap()
, pois os valores dentro dessas listas é null.

Alguém sabe como resolver este problema?

Criado 2 de novembro de 2009
Respostas 0
Participantes 1