Revision 1317,
1.2 KB
checked in by wojtekp, 11 years ago
(diff) |
|
-
Property svn:mime-type set to
text/plain
|
Rev | Line | |
---|
[1207] | 1 | package schedframe.resources.devices; |
---|
| 2 | |
---|
| 3 | import java.util.List; |
---|
| 4 | |
---|
| 5 | import org.joda.time.DateTimeUtils; |
---|
| 6 | |
---|
| 7 | import schedframe.Parameters; |
---|
| 8 | import schedframe.resources.computing.profiles.energy.thermal.TemperatureValue; |
---|
| 9 | import schedframe.resources.computing.profiles.energy.thermal.ThermalProfile; |
---|
| 10 | import schedframe.resources.computing.profiles.energy.thermal.ui.ThermalInterface; |
---|
| 11 | |
---|
[1317] | 12 | public class DeviceThermalInterface implements ThermalInterface{ |
---|
[1207] | 13 | |
---|
| 14 | private static int START_TEMP = 0; |
---|
| 15 | protected PhysicalResource resource; |
---|
| 16 | protected ThermalProfile thermalProfile; |
---|
| 17 | |
---|
[1317] | 18 | public DeviceThermalInterface(PhysicalResource resource, ThermalProfile thermalProfile) { |
---|
[1207] | 19 | super(); |
---|
| 20 | this.resource = resource; |
---|
| 21 | this.thermalProfile = thermalProfile; |
---|
| 22 | } |
---|
| 23 | |
---|
| 24 | public TemperatureValue getRecentTemperature() { |
---|
| 25 | TemperatureValue temperature = null; |
---|
| 26 | int lastIdx = getTemperatureHistory().size() - 1; |
---|
| 27 | if(lastIdx >= 0) |
---|
| 28 | temperature = getTemperatureHistory().get(lastIdx); |
---|
| 29 | else { |
---|
| 30 | temperature = new TemperatureValue(DateTimeUtils.currentTimeMillis(), START_TEMP); |
---|
| 31 | } |
---|
| 32 | return temperature; |
---|
| 33 | } |
---|
| 34 | |
---|
| 35 | public List<TemperatureValue> getTemperatureHistory() { |
---|
| 36 | return thermalProfile.getTemperatureHistory(); |
---|
| 37 | } |
---|
| 38 | |
---|
| 39 | public Parameters getParameters() { |
---|
| 40 | return thermalProfile.getParameters(); |
---|
| 41 | } |
---|
| 42 | |
---|
| 43 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.