1 | package schedframe.resources.computing; |
---|
2 | |
---|
3 | import schedframe.Parameters; |
---|
4 | import schedframe.resources.computing.location.Location; |
---|
5 | |
---|
6 | |
---|
7 | public class ResourceCharacteristics /*extends Properties*/{ |
---|
8 | |
---|
9 | private static final long serialVersionUID = 2719535186621622647L; |
---|
10 | |
---|
11 | protected Location location; |
---|
12 | protected Parameters parameters; |
---|
13 | //protected Location location; |
---|
14 | //protected List<Device> devices; |
---|
15 | |
---|
16 | /*public ResourceCharacteristics(Map<ResourceUnitName, List<AbstractResourceUnit>> resUnits){ |
---|
17 | this.resUnits = resUnits; |
---|
18 | } |
---|
19 | |
---|
20 | public ResourceCharacteristics(){ |
---|
21 | this.resUnits = null; |
---|
22 | } |
---|
23 | |
---|
24 | public ResourceCharacteristics(Map<ResourceUnitName, List<AbstractResourceUnit>> resUnits, Parameters parameters){ |
---|
25 | this(resUnits); |
---|
26 | }*/ |
---|
27 | |
---|
28 | |
---|
29 | |
---|
30 | public Parameters getParameters() { |
---|
31 | if(parameters == null) |
---|
32 | return new Parameters(); |
---|
33 | return parameters; |
---|
34 | } |
---|
35 | |
---|
36 | public Location getLocation() { |
---|
37 | return location; |
---|
38 | } |
---|
39 | |
---|
40 | protected ResourceCharacteristics(Builder<?> builder) { |
---|
41 | //this.location = builder.location; |
---|
42 | this.parameters = builder.parameters; |
---|
43 | this.location = builder.location; |
---|
44 | //this.devices = builder.devices; |
---|
45 | } |
---|
46 | |
---|
47 | public static abstract class Builder<T extends Builder<T>> { |
---|
48 | |
---|
49 | protected Location location; |
---|
50 | protected Parameters parameters; |
---|
51 | |
---|
52 | public T parameters(Parameters params){this.parameters = params; return self(); } |
---|
53 | public T location(Location loc){this.location = loc; return self(); } |
---|
54 | |
---|
55 | protected abstract T self(); |
---|
56 | |
---|
57 | public ResourceCharacteristics build() { |
---|
58 | return new ResourceCharacteristics(this); |
---|
59 | } |
---|
60 | } |
---|
61 | private static class Builder2 extends Builder<Builder2> { |
---|
62 | @Override |
---|
63 | protected Builder2 self() { |
---|
64 | return this; |
---|
65 | } |
---|
66 | } |
---|
67 | |
---|
68 | public static Builder<?> builder() { |
---|
69 | return new Builder2(); |
---|
70 | } |
---|
71 | |
---|
72 | /*public static class Builder { |
---|
73 | |
---|
74 | protected Map<ResourceUnitName, List<ResourceUnit>> resUnits; |
---|
75 | //protected Location location; |
---|
76 | protected Parameters parameters; |
---|
77 | //protected List<Device> devices; |
---|
78 | |
---|
79 | //public Builder location(Location loc){this.location = loc; return this; } |
---|
80 | public Builder parameters(Parameters params){this.parameters = params; return this; } |
---|
81 | //public Builder device(List<Device> dev){this.devices = dev; return this; } |
---|
82 | public Builder resourceUnits(Map<ResourceUnitName, List<ResourceUnit>> units){this.resUnits = units; return this; } |
---|
83 | public Builder resourceUnits(){this.resUnits = new HashMap<ResourceUnitName, List<ResourceUnit>>(2); return this; } |
---|
84 | |
---|
85 | public ResourceCharacteristics build() { |
---|
86 | return new ResourceCharacteristics(this); |
---|
87 | } |
---|
88 | } |
---|
89 | */ |
---|
90 | |
---|
91 | |
---|
92 | } |
---|