source: DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/phases/ResourceConsumption.java @ 896

Revision 896, 1.8 KB checked in by wojtekp, 12 years ago (diff)
Line 
1package schedframe.scheduling.tasks.phases;
2
3import java.util.ArrayList;
4import java.util.List;
5
6import org.qcg.broker.schemas.resreqs.ComputingResourceBaseTypeItem;
7import org.qcg.broker.schemas.resreqs.ComputingResourceParameterType;
8import org.qcg.broker.schemas.resreqs.PhaseBehaviourType;
9import org.qcg.broker.schemas.resreqs.ResourceConsumptionType;
10
11public class ResourceConsumption {
12
13        protected String id;
14    protected String referenceHardware;
15    protected long duration;
16    protected List<PhaseBehaviour> phaseBehaviourList;
17   
18    public ResourceConsumption(long duration, ComputingResourceBaseTypeItem item[]){
19        this.id = null;
20        this.referenceHardware = null;
21        this.duration = duration;
22        this.phaseBehaviourList = new ArrayList<PhaseBehaviour>();
23        for(ComputingResourceBaseTypeItem compResItem: item){
24                ComputingResourceParameterType hostParameter = compResItem.getHostParameter();
25                PhaseBehaviour pb = new PhaseBehaviour(hostParameter.getName().toString());
26                phaseBehaviourList.add(pb);
27        }
28    }
29   
30    public ResourceConsumption(ResourceConsumptionType resConsumptionType){
31        this.id = resConsumptionType.getId();
32        this.referenceHardware = resConsumptionType.getReferenceHardware();
33        this.duration = resConsumptionType.getDuration().toLong()/1000;
34        this.phaseBehaviourList = new ArrayList<PhaseBehaviour>();
35        for(PhaseBehaviourType pbt: resConsumptionType.getBehaviour()){
36                PhaseBehaviour pb = new PhaseBehaviour(pbt);
37                phaseBehaviourList.add(pb);
38        }
39    }
40   
41        public String getId() {
42                return id;
43        }
44
45        public void setId(String id) {
46                this.id = id;
47        }
48
49        public String getReferenceHardware() {
50                return referenceHardware;
51        }
52
53        public long getDuration() {
54                return duration;
55        }
56
57        public List<PhaseBehaviour> getBehaviourList() {
58                return phaseBehaviourList;
59        }
60
61}
Note: See TracBrowser for help on using the repository browser.