Ignore:
Timestamp:
03/19/14 18:22:27 (11 years ago)
Author:
wojtekp
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • DCWoRMS/branches/coolemall/src/schedframe/resources/computing/coolemall/NodeGroup.java

    r1247 r1299  
    11package schedframe.resources.computing.coolemall; 
    22 
     3import java.util.ArrayList; 
    34import java.util.List; 
    45 
     
    89import schedframe.resources.computing.Processor; 
    910import schedframe.resources.computing.description.ComputingResourceDescription; 
     11import schedframe.resources.computing.description.ResourceDescription; 
     12import schedframe.resources.devices.Device; 
     13import schedframe.resources.devices.Fan; 
     14import test.Node_Fan_Mapping; 
    1015 
    1116public class NodeGroup extends ComputingResource{ 
     
    1318        public NodeGroup(ComputingResourceDescription resDesc) { 
    1419                super(resDesc); 
     20                initNodes_FansMapping(resDesc); 
    1521        } 
    1622 
     
    2531        } 
    2632 
     33         
     34        private void initNodes_FansMapping(ComputingResourceDescription resDesc){ 
     35                Node_Fan_Mapping.init(); 
     36                for(Device dev: this.getResourceCharacteristic().getDevices()){ 
     37                        if(dev.getType().equals(StandardResourceType.Fan) || dev.getType().equals(StandardResourceType.Inlet) | dev.getType().equals(StandardResourceType.Outlet)){ 
     38                                Fan fan = (Fan) dev; 
     39                                List<String> chilledResources = new ArrayList<String>(); 
     40                                for(ResourceDescription nodeDesc: resDesc.getChildren()){ 
     41                                        String nodeName = this.getFullName() + "/" + nodeDesc.getId(); 
     42                                        if(!Node_Fan_Mapping.getNode_fan().containsKey(nodeName)){ 
     43                                                chilledResources.add(nodeName); 
     44                                        } else if(Node_Fan_Mapping.getNode_fan().get(nodeName).equals(fan.getFullName())){ 
     45                                                chilledResources.add(nodeName); 
     46                                        } else { 
     47                                                //if mapping present but there is no match do nothing 
     48                                        } 
     49                                } 
     50                                fan.setChilledResources(chilledResources); 
     51                        } 
     52                } 
     53        } 
    2754} 
Note: See TracChangeset for help on using the changeset viewer.