package schedframe.resources.devices; import java.util.List; import org.joda.time.DateTimeUtils; import schedframe.Parameters; import schedframe.resources.computing.profiles.energy.thermal.TemperatureValue; import schedframe.resources.computing.profiles.energy.thermal.ThermalProfile; import schedframe.resources.computing.profiles.energy.thermal.ui.ThermalInterface; public class DeviceThermalInterface implements ThermalInterface{ private static int START_TEMP = 0; protected PhysicalResource resource; protected ThermalProfile thermalProfile; public DeviceThermalInterface(PhysicalResource resource, ThermalProfile thermalProfile) { super(); this.resource = resource; this.thermalProfile = thermalProfile; } public TemperatureValue getRecentTemperature() { TemperatureValue temperature = null; int lastIdx = getTemperatureHistory().size() - 1; if(lastIdx >= 0) temperature = getTemperatureHistory().get(lastIdx); else { temperature = new TemperatureValue(DateTimeUtils.currentTimeMillis(), START_TEMP); } return temperature; } public List getTemperatureHistory() { return thermalProfile.getTemperatureHistory(); } public Parameters getParameters() { return thermalProfile.getParameters(); } }