source: xssim/src/test/rewolucja/extensions/ExtensionListImpl.java @ 104

Revision 104, 1.0 KB checked in by wojtekp, 13 years ago (diff)
  • Property svn:mime-type set to text/plain
Line 
1package test.rewolucja.extensions;
2
3import java.util.ArrayList;
4import java.util.List;
5
6
7
8public class ExtensionListImpl extends ArrayList<Extension> implements ExtensionList {
9
10        private static final long serialVersionUID = -3824600938144742457L;
11
12        public ExtensionListImpl(){
13                super();
14        }
15       
16        public ExtensionListImpl(int initialSize){
17                super(initialSize);
18        }
19       
20        public List<Extension> get(ExtensionType type){
21                List<Extension> list = null;
22               
23                for(int i = 0; i < size(); i++){
24                        Extension e = get(i);
25                        if(e.getType() == type){
26                                list = (list == null ? new ArrayList<Extension>(1) : list);
27                                list.add(e);
28                        }
29                }
30                return list;
31        }
32       
33        public Extension getExtension(ExtensionType type){
34               
35                for(int i = 0; i < size(); i++){
36                        Extension e = get(i);
37                        if(e.getType() == type){
38                                return e;
39                        }
40                }
41                return null;
42        }
43       
44        public boolean isExtensionAvailable(ExtensionType type){
45                for(int i = 0; i < size(); i++){
46                        Extension e = get(i);
47                        if(e.getType() == type){
48                                return true;
49                        }
50                }
51                return false;
52        }
53       
54       
55}
Note: See TracBrowser for help on using the repository browser.