source: xssim/src/schedframe/scheduling/plugin/grid/ModuleListImpl.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 schedframe.scheduling.plugin.grid;
2
3import java.util.ArrayList;
4import java.util.List;
5
6/**
7 *
8 * @author Marcin Krystek
9 *
10 */
11public class ModuleListImpl extends ArrayList<Module> implements ModuleList {
12
13        private static final long serialVersionUID = -3824600938144742457L;
14
15        public ModuleListImpl(){
16                super();
17        }
18       
19        public ModuleListImpl(int initialSize){
20                super(initialSize);
21        }
22       
23        public List<Module> get(ModuleType type){
24                List<Module> list = null;
25               
26                for(int i = 0; i < size(); i++){
27                        Module m = get(i);
28                        if(m.getType() == type){
29                                list = (list == null ? new ArrayList<Module>(1) : list);
30                                list.add(m);
31                        }
32                }
33                return list;
34        }
35       
36        public Module getModule(ModuleType type){
37               
38                for(int i = 0; i < size(); i++){
39                        Module m = get(i);
40                        if(m.getType() == type){
41                                return m;
42                        }
43                }
44                return null;
45        }
46       
47        public boolean isModuleAvailable(ModuleType type){
48                for(int i = 0; i < size(); i++){
49                        Module m = get(i);
50                        if(m.getType() == type){
51                                return true;
52                        }
53                }
54                return false;
55        }
56       
57       
58}
Note: See TracBrowser for help on using the repository browser.