/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package sidnet.utilityviews.statscollector;

import sidnet.core.misc.Node;

/**
 *
 * @author Oliver
 */
public class StatEntry_MaximumEnergyLeftPercentage extends StatEntry{
    private double maximumEnergyLeftPercentage = 0;

    public StatEntry_MaximumEnergyLeftPercentage() {
        this("MaximumEnergyLeftPercentage"); // default header
    }

    public StatEntry_MaximumEnergyLeftPercentage(String customHeader)
    {
        super(customHeader);
    }
            
    
    /**
     * @inheridoc
     */
    public String getValueAsString()
    {
        return "" + maximumEnergyLeftPercentage;
    }
    
    /**
     * @inheridoc
     */
   public void update(Node[] nodes)
   {
       maximumEnergyLeftPercentage = 0;
       for (int i = 0; i < nodes.length; i++)
           if (nodes[i].getEnergyManagement().getBattery().getPercentageEnergyLevel() > maximumEnergyLeftPercentage)
                maximumEnergyLeftPercentage = nodes[i].getEnergyManagement().getBattery().getPercentageEnergyLevel();
   }

}
