1 | package org.expeditee.agents;
|
---|
2 |
|
---|
3 | import java.util.Collection;
|
---|
4 | import java.util.HashMap;
|
---|
5 | import java.util.Map;
|
---|
6 |
|
---|
7 | import org.expeditee.gui.Frame;
|
---|
8 | import org.expeditee.gui.FrameIO;
|
---|
9 |
|
---|
10 | public class SearchFramesetNoResults extends SearchAgent {
|
---|
11 | private long _firstFrame = 1;
|
---|
12 | private long _maxFrame = Integer.MAX_VALUE;
|
---|
13 | private Map<String, Collection<String>> _results = new HashMap<String, Collection<String>>();
|
---|
14 |
|
---|
15 | public SearchFramesetNoResults(long firstFrame, long maxFrame) {
|
---|
16 | _firstFrame = firstFrame;
|
---|
17 | _maxFrame = maxFrame;
|
---|
18 | }
|
---|
19 |
|
---|
20 | public SearchFramesetNoResults() {
|
---|
21 | super();
|
---|
22 | }
|
---|
23 |
|
---|
24 | @Override
|
---|
25 | protected Frame process(Frame frame) {
|
---|
26 | String path = frame.path;
|
---|
27 | _frameCount = FrameIO.getLastNumber(frame.getFramesetName());
|
---|
28 | for (long i = _firstFrame;i <= _maxFrame && i < _frameCount; i++) {
|
---|
29 | if (_stop) {
|
---|
30 | break;
|
---|
31 | }
|
---|
32 | String frameName = _startName + i;
|
---|
33 | Collection<String> found = FrameIO.searchFrame(frameName, _pattern, path);
|
---|
34 | int size = found == null? 0 :found.size();
|
---|
35 | if(size > 0){
|
---|
36 | _results.put(frameName, found);
|
---|
37 | }
|
---|
38 | }
|
---|
39 | return null;
|
---|
40 | }
|
---|
41 |
|
---|
42 | public Map<String, Collection<String>> getResult(){
|
---|
43 | return _results;
|
---|
44 | }
|
---|
45 |
|
---|
46 | @Override
|
---|
47 | public boolean hasResultFrame() {
|
---|
48 | return false;
|
---|
49 | }
|
---|
50 | }
|
---|