Project

General

Profile

1
import java.util.ArrayList;
2
import java.util.List;
3

    
4
import eu.dnetlib.data.utility.featureextraction.FeatureExtractionException;
5
import eu.dnetlib.data.utility.featureextraction.dataprovider.SourceDataProvider;
6

    
7

    
8
public class MySourceDataProvider implements SourceDataProvider {
9
	
10
	ArrayList<String> DMFRecords;
11
	
12
	public MySourceDataProvider() {
13
		this.DMFRecords = new ArrayList<String>();
14
	}
15
	
16
	public void addDMFRecord(String record) {
17
		DMFRecords.add(record);
18
	}
19

    
20
	@Override
21
	public List<String> getRecords(int from, int to)
22
			throws FeatureExtractionException {
23
		try {
24
			if(to >= this.DMFRecords.size())
25
				to = this.DMFRecords.size();
26
			return DMFRecords.subList(from-1, to);
27
		}
28
		catch(Exception e) {
29
			throw new FeatureExtractionException(e);
30
		}
31
	}
32

    
33
	@Override
34
	public int getSize() throws FeatureExtractionException {
35
		return this.DMFRecords.size();
36
	}
37

    
38
	@Override
39
	public String getStatus() throws FeatureExtractionException {
40
		// TODO Auto-generated method stub
41
		return null;
42
	}
43

    
44
}
(2-2/14)