source: DCWoRMS/branches/coolemall/src/schedframe/resources/devices/DeviceThermalInterface.java @ 1317

Revision 1317, 1.2 KB checked in by wojtekp, 11 years ago (diff)
  • Property svn:mime-type set to text/plain
Line 
1package schedframe.resources.devices;
2
3import java.util.List;
4
5import org.joda.time.DateTimeUtils;
6
7import schedframe.Parameters;
8import schedframe.resources.computing.profiles.energy.thermal.TemperatureValue;
9import schedframe.resources.computing.profiles.energy.thermal.ThermalProfile;
10import schedframe.resources.computing.profiles.energy.thermal.ui.ThermalInterface;
11
12public class DeviceThermalInterface implements ThermalInterface{
13
14        private static int START_TEMP = 0;
15        protected PhysicalResource resource;
16        protected ThermalProfile thermalProfile;
17
18        public DeviceThermalInterface(PhysicalResource resource, ThermalProfile thermalProfile) {
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.