Revision 104,
1.0 KB
checked in by wojtekp, 13 years ago
(diff) |
|
-
Property svn:mime-type set to
text/plain
|
Line | |
---|
1 | package test.rewolucja.resources.properties; |
---|
2 | |
---|
3 | import java.util.Properties; |
---|
4 | |
---|
5 | import test.rewolucja.resources.physical.base.ComputingResource; |
---|
6 | import test.rewolucja.resources.physical.implementation.CPU; |
---|
7 | |
---|
8 | public class CpuPropertiesBuilder implements PropertiesBuilder{ |
---|
9 | protected Properties properties; |
---|
10 | private CPU cpu; |
---|
11 | |
---|
12 | public Properties getProperties() { |
---|
13 | return properties; |
---|
14 | } |
---|
15 | |
---|
16 | public void createProperties(ComputingResource resource) { |
---|
17 | this.properties = new Properties(); |
---|
18 | this.cpu = (CPU)resource; |
---|
19 | } |
---|
20 | |
---|
21 | public void buildBasicProperties() { |
---|
22 | properties.setProperty("name", cpu.getName()); |
---|
23 | properties.setProperty("type", cpu.getType().toString()); |
---|
24 | properties.setProperty("status", cpu.getStatus().toString()); |
---|
25 | } |
---|
26 | |
---|
27 | public void buildCharacteristicsProperties() { |
---|
28 | properties.setProperty("speed", String.valueOf(cpu.getMIPS())); |
---|
29 | } |
---|
30 | |
---|
31 | public void buildDescriptionProperties() { |
---|
32 | for(String key: cpu.getResourceCharacteristic().stringPropertyNames()){ |
---|
33 | properties.setProperty(key, cpu.getResourceCharacteristic().getProperty(key)); |
---|
34 | } |
---|
35 | |
---|
36 | } |
---|
37 | |
---|
38 | |
---|
39 | |
---|
40 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.