Revision 199,
1.1 KB
checked in by wojtekp, 13 years ago
(diff) |
|
-
Property svn:mime-type set to
text/plain
|
Rev | Line | |
---|
[104] | 1 | package test.rewolucja.resources.properties; |
---|
| 2 | |
---|
| 3 | import java.util.Properties; |
---|
| 4 | |
---|
| 5 | import test.rewolucja.resources.physical.base.ComputingResource; |
---|
[199] | 6 | import test.rewolucja.resources.physical.implementation.Processor; |
---|
[104] | 7 | |
---|
| 8 | public class CpuPropertiesBuilder implements PropertiesBuilder{ |
---|
| 9 | protected Properties properties; |
---|
[199] | 10 | private Processor cpu; |
---|
[104] | 11 | |
---|
| 12 | public Properties getProperties() { |
---|
| 13 | return properties; |
---|
| 14 | } |
---|
| 15 | |
---|
| 16 | public void createProperties(ComputingResource resource) { |
---|
| 17 | this.properties = new Properties(); |
---|
[199] | 18 | this.cpu = (Processor)resource; |
---|
[104] | 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.