1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| public void table_graph(int parameter){
ArrayList<Double> freq = new ArrayList<Double>();
ArrayList<Double> theta = new ArrayList<Double>();
try {
StreamTokenizer st = new StreamTokenizer(new BufferedReader(new FileReader("plot.txt")));
int i;
int place = 1;
while((i=st.nextToken())!=StreamTokenizer.TT_EOF){
switch(st.ttype){
case StreamTokenizer.TT_NUMBER:
if (place % 2 == 1){
freq.add(st.nval);
}
if (place % 2 == 0){
theta.add(st.nval);
}
place++;
break;
default:
}
}
}
catch (FileNotFoundException e) {
e.printStackTrace();
}
catch (IOException e) {
e.printStackTrace();
}
if (parameter==1) {
DisplayTable displaytable = new DisplayTable(freq.toArray(), theta.toArray());}
if (parameter==2) {DisplayGraph displaygraph = new DisplayGraph(freq, theta);}
}
} |
Partager