-
Notifications
You must be signed in to change notification settings - Fork 1
/
DatasetModel.java
35 lines (28 loc) · 1.03 KB
/
DatasetModel.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
import java.io.IOException;
import java.util.ArrayList;
import javax.xml.parsers.ParserConfigurationException;
import org.xml.sax.SAXException;
public class DatasetModel {
private ArrayList<RecordModel> DataList;
public void SetData(String url) throws SAXException, IOException, ParserConfigurationException {
DataList = Parser.GetData(url);
}
public ArrayList<String> AllCntrName(){//bu fonksiyonu Bütün ülkelerin ismini listelerken kullan
ArrayList<String> list = new ArrayList<>();
for (RecordModel rm : DataList){
if(!list.contains(rm.GetCountry())){
list.add(rm.GetCountry());
}
}
return list;
}
public ArrayList<RecordModel> RcsByCountry(String cname){//Bu fonksiyon adı girilen ülkenin recordlarını döndürür.
ArrayList<RecordModel> list = new ArrayList<>();
for (RecordModel rm : DataList){
if(rm.GetCountry() == cname){
list.add(rm);
}
}
return list;
}
}