-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMyIndReader.java
More file actions
53 lines (49 loc) · 1.32 KB
/
MyIndReader.java
File metadata and controls
53 lines (49 loc) · 1.32 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
import java.io.*;
import java.util.StringTokenizer;
public class MyIndReader{
BufferedReader br = null;
int count_ind = 0;
String datafile = "";
public MyIndReader(String IndData){
try{
br = new BufferedReader(new FileReader(IndData));
}catch(FileNotFoundException e){
System.out.println("File not found");
}
}
public int read(String[] ind_names, MyDate[] date, float[][] ind_datas){
int count=0;
String line;
//Date = new String[250];
try{
line = br.readLine();
datafile = line;
line = br.readLine();
StringTokenizer st0 = new StringTokenizer(line,"\t");
String temp = st0.nextToken();
while(st0.hasMoreTokens()){
ind_names[count_ind] = st0.nextToken();
count_ind++;
}
while ((line = br.readLine()) != null){
StringTokenizer st = new StringTokenizer(line,"\t");
int tmp = 0;
date[count]=new MyDate(st.nextToken());
while(st.hasMoreTokens()){
ind_datas[tmp][count] = Float.parseFloat(st.nextToken());
tmp++;
count++;
}
}
}catch (IOException e){
System.out.println("Something else");
}
return count;
}
public int getIndicatorNo(){
return count_ind;
}
public String getDataFilePath(){
return datafile;
}
}