-
Notifications
You must be signed in to change notification settings - Fork 0
/
AttributeList.java
64 lines (55 loc) · 1.8 KB
/
AttributeList.java
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
54
55
56
57
58
59
60
61
62
63
64
import java.util.*;
import java.io.*;
public class AttributeList{
List<Attribute> attribute_list = new ArrayList<Attribute>();
public Attribute get(int i) {
return attribute_list.get(i);
}
public int size() {
return attribute_list.size();
}
public AttributeList(String s) {
String csvFile = s;
BufferedReader br = null;
String line = "";
String cvsSplitBy = ";";
int flag=0;
try {
br = new BufferedReader(new FileReader(csvFile));
// line = br.readLine();
// System.out.println(line);
// line = br.readLine();
// System.out.println(line);
// line = br.readLine();
// System.out.println(line);
// line = br.readLine();
// System.out.println(line);
while ((line = br.readLine()) != null) {
if(flag==1) {
String[] entry = line.split(cvsSplitBy);
Attribute temp = new Attribute(entry[0],entry[1],entry[2]);
attribute_list.add(temp);
}
else {
flag=1;
}
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (br != null) {
try {
br.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
// public static void main(String[] args) {
// AttributeList newlist = new AttributeList("AttributeType.csv");
// System.out.println(newlist.size());
// }
}