source: trunk/src/org/expeditee/agents/SearchFramesetNoResults.java@ 162

Last change on this file since 162 was 162, checked in by ra33, 16 years ago

Added faster versions of search frameset

File size: 1.2 KB
Line 
1package org.expeditee.agents;
2
3import java.util.Collection;
4import java.util.HashMap;
5import java.util.Map;
6
7import org.expeditee.gui.Frame;
8import org.expeditee.gui.FrameIO;
9
10public 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}
Note: See TracBrowser for help on using the repository browser.