Ignore:
Timestamp:
06/26/14 14:18:01 (11 years ago)
Author:
wojtekp
Message:
 
File:
1 moved

Legend:

Unmodified
Added
Removed
  • DCWoRMS/branches/coolemall/src/schedframe/resources/devices/DeviceAirflowInterface.java

    r1380 r1396  
    99import schedframe.resources.computing.profiles.energy.EnergyEvent; 
    1010import schedframe.resources.computing.profiles.energy.EnergyEventType; 
    11 import schedframe.resources.computing.profiles.energy.airthroughput.AirFlowValue; 
    12 import schedframe.resources.computing.profiles.energy.airthroughput.AirThroughputProfile; 
    13 import schedframe.resources.computing.profiles.energy.airthroughput.AirThroughputState; 
    14 import schedframe.resources.computing.profiles.energy.airthroughput.AirThroughputStateName; 
    15 import schedframe.resources.computing.profiles.energy.airthroughput.StandardAirThroughputStateName; 
    16 import schedframe.resources.computing.profiles.energy.airthroughput.ui.AirThroughputInterface; 
     11import schedframe.resources.computing.profiles.energy.airthroughput.AirflowValue; 
     12import schedframe.resources.computing.profiles.energy.airthroughput.AirflowProfile; 
     13import schedframe.resources.computing.profiles.energy.airthroughput.AirflowState; 
     14import schedframe.resources.computing.profiles.energy.airthroughput.AirflowStateName; 
     15import schedframe.resources.computing.profiles.energy.airthroughput.StandardAirflowStateName; 
     16import schedframe.resources.computing.profiles.energy.airthroughput.ui.AirflowInterface; 
    1717 
    18 public class DeviceAirThroughputInterface implements AirThroughputInterface{ 
     18public class DeviceAirflowInterface implements AirflowInterface{ 
    1919 
    20         protected AirThroughputStateName currentAirThroughputState; 
    21         protected AirThroughputProfile airThroughputProfile; 
     20        protected AirflowStateName currentAirflowState; 
     21        protected AirflowProfile airflowProfile; 
    2222        protected PhysicalResource resource; 
    2323         
    24         public DeviceAirThroughputInterface(PhysicalResource resource, AirThroughputProfile airThroughputProfile){ 
     24        public DeviceAirflowInterface(PhysicalResource resource, AirflowProfile airflowProfile){ 
    2525                this.resource = resource; 
    26                 this.airThroughputProfile = airThroughputProfile; 
    27                 this.currentAirThroughputState = StandardAirThroughputStateName.ON; 
     26                this.airflowProfile = airflowProfile; 
     27                this.currentAirflowState = StandardAirflowStateName.ON; 
    2828        } 
    2929         
    30         public AirThroughputStateName getAirThroughputState() { 
    31                 return currentAirThroughputState; 
     30        public AirflowStateName getAirflowState() { 
     31                return currentAirflowState; 
    3232        } 
    3333 
    34         public boolean setAirThroughputState(AirThroughputStateName state) { 
    35                 if(supportAirThroughputState(state)){ 
    36                         currentAirThroughputState = state; 
     34        public boolean setAirflowState(AirflowStateName state) { 
     35                if(supportAirflowState(state)){ 
     36                        currentAirflowState = state; 
    3737                         
    3838                        //TO DO - notifications should be called for all resources starting form the lowest layer 
     
    4444        } 
    4545 
    46         public boolean supportAirThroughputState(AirThroughputStateName state) { 
    47                 for(AirThroughputState airFlowState: airThroughputProfile.getAirThroughputStates()){ 
    48                         if(airFlowState.getName().equals(state.getName())){ 
     46        public boolean supportAirflowState(AirflowStateName state) { 
     47                for(AirflowState airflowState: airflowProfile.getAirflowStates()){ 
     48                        if(airflowState.getName().getLabel().equals(state.getLabel())){ 
    4949                                return true; 
    5050                        } 
     
    5353        } 
    5454 
    55         public List<AirThroughputState> getSupportedAirThroughputStates(){ 
    56                 List<AirThroughputState> airThroughputStates = new ArrayList<AirThroughputState>(); 
    57                 for(AirThroughputState airFlowState: airThroughputProfile.getAirThroughputStates()){ 
    58                         airThroughputStates.add(airFlowState); 
     55        public List<AirflowState> getSupportedAirflowStates(){ 
     56                List<AirflowState> airflowStates = new ArrayList<AirflowState>(); 
     57                for(AirflowState airFlowState: airflowProfile.getAirflowStates()){ 
     58                        airflowStates.add(airFlowState); 
    5959                } 
    60                 return airThroughputStates; 
     60                return airflowStates; 
    6161        } 
    6262 
    63         public double getAirFlow(AirThroughputStateName state) throws NoSuchFieldException { 
    64                 double airThroughput = 0; 
    65                 if(supportAirThroughputState(state)){ 
    66                         for(AirThroughputState airFlowState: airThroughputProfile.getAirThroughputStates()){ 
    67                                 if(airFlowState.getName().equals(state.getName())){ 
    68                                         airThroughput = airFlowState.getValue(); 
     63        public double getAirflow(AirflowStateName state) throws NoSuchFieldException { 
     64                double airflow = 0; 
     65                if(supportAirflowState(state)){ 
     66                        for(AirflowState airflowState: airflowProfile.getAirflowStates()){ 
     67                                if(airflowState.getName().getLabel().equals(state.getLabel())){ 
     68                                        airflow = airflowState.getValue(); 
    6969                                        break; 
    7070                                } 
    7171                        } 
    7272                } 
    73                 return airThroughput; 
     73                return airflow; 
    7474        } 
    7575 
    76         public double getPowerConsumption(AirThroughputStateName state) throws NoSuchFieldException { 
     76        public double getPowerConsumption(AirflowStateName state) throws NoSuchFieldException { 
    7777                double powerConsumption = 0; 
    78                 if(supportAirThroughputState(state)){ 
    79                         for(AirThroughputState airFlowState: airThroughputProfile.getAirThroughputStates()){ 
    80                                 if(airFlowState.getName().equals(state.getName())){ 
    81                                         powerConsumption = airFlowState.getPowerUsage(); 
     78                if(supportAirflowState(state)){ 
     79                        for(AirflowState airflowState: airflowProfile.getAirflowStates()){ 
     80                                if(airflowState.getName().getLabel().equals(state.getLabel())){ 
     81                                        powerConsumption = airflowState.getPowerUsage(); 
    8282                                        break; 
    8383                                } 
     
    8787        } 
    8888         
    89         public AirFlowValue getRecentAirFlow() { 
    90                 AirFlowValue airFlow = null; 
    91                 int lastIdx = getAirFlowHistory().size() - 1; 
     89        public AirflowValue getRecentAirflow() { 
     90                AirflowValue airflow = null; 
     91                int lastIdx = getAirflowHistory().size() - 1; 
    9292                if(lastIdx >= 0) 
    93                         airFlow = getAirFlowHistory().get(lastIdx); 
     93                        airflow = getAirflowHistory().get(lastIdx); 
    9494                else {   
    9595                        try { 
    96                                 airFlow = new AirFlowValue(DateTimeUtils.currentTimeMillis(), getAirFlow(currentAirThroughputState)); 
     96                                airflow = new AirflowValue(DateTimeUtils.currentTimeMillis(), getAirflow(currentAirflowState)); 
    9797                        } catch (NoSuchFieldException e) { 
    9898                        } 
    9999                } 
    100                 return airFlow; 
     100                return airflow; 
    101101        } 
    102102         
    103         public List<AirFlowValue> getAirFlowHistory(){ 
    104                 return airThroughputProfile.getAirThroughputHistory(); 
     103        public List<AirflowValue> getAirflowHistory(){ 
     104                return airflowProfile.getAirflowHistory(); 
    105105        } 
    106106         
    107107        public Parameters getParameters() { 
    108                 return airThroughputProfile.getParameters(); 
     108                return airflowProfile.getParameters(); 
    109109        } 
    110110 
Note: See TracChangeset for help on using the changeset viewer.