1 | package schedframe.scheduling.tasks.phases; |
---|
2 | |
---|
3 | import java.util.ArrayList; |
---|
4 | import java.util.List; |
---|
5 | |
---|
6 | import org.qcg.broker.schemas.resreqs.ComputingResourceBaseTypeItem; |
---|
7 | import org.qcg.broker.schemas.resreqs.ComputingResourceParameterType; |
---|
8 | import org.qcg.broker.schemas.resreqs.PhaseBehaviourType; |
---|
9 | import org.qcg.broker.schemas.resreqs.ResourceConsumptionType; |
---|
10 | |
---|
11 | public 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 void setReferenceHardware(String referenceHardware) { |
---|
54 | this.referenceHardware = referenceHardware; |
---|
55 | } |
---|
56 | |
---|
57 | public long getDuration() { |
---|
58 | return duration; |
---|
59 | } |
---|
60 | |
---|
61 | public void setDuration(long duration) { |
---|
62 | this.duration = duration; |
---|
63 | } |
---|
64 | |
---|
65 | public List<PhaseBehaviour> getBehaviourList() { |
---|
66 | return phaseBehaviourList; |
---|
67 | } |
---|
68 | |
---|
69 | public void setBehaviourList(List<PhaseBehaviour> behaviourList) { |
---|
70 | this.phaseBehaviourList = behaviourList; |
---|
71 | } |
---|
72 | } |
---|