Fixes Agent.getHarvestCount() to actually return count and not duration/time. Reported by Luca Antonioli.

This commit is contained in:
lubomir.marinov 2014-07-23 11:10:21 +00:00
parent ee4721960b
commit a3caa371aa

View File

@ -2311,13 +2311,14 @@ public class Agent
} }
/** /**
* Returns the number of harvesting time for the harvester given in * Returns the number of harvests that a harvester with a specific class
* parameter. * name has completed so far.
* *
* @param harvesterName The class name if the harvester. * @param harvesterName the class name of the harvester for which the
* * number of completed harvests is to be returned
* @return The number of harvesting time for the harvester given in * @return the number of harvests that the harvester with the specified
* parameter. * <tt>harvesterName</tt> has completed so far if such a harvester exists
* and has completed at least one harvest; otherwise, zero
*/ */
public int getHarvestCount(String harvesterName) public int getHarvestCount(String harvesterName)
{ {
@ -2360,12 +2361,12 @@ public class Agent
} }
/** /**
* Returns the total number of harvests completed by this agent. Normally * Returns the total number of harvests completed by this agent. Normally,
* this number should be equal to NB_HARVESTERS*NB_COMPONENTS but could be * this number should be equal to <tt>NB_HARVESTERS * NB_COMPONENTS</tt> but
* less if some harvesters were disabled for inefficiency or more ... if * could be less, for example, if some harvesters were disabled for
* there's a bug ;). * inefficiency.
* *
* @return the number of harvest this agent has completed. * @return the number of harvests this agent has completed.
*/ */
public int getHarvestCount() public int getHarvestCount()
{ {
@ -2373,8 +2374,7 @@ public class Agent
for(CandidateHarvester harvester : harvesters) for(CandidateHarvester harvester : harvesters)
{ {
harvestCount harvestCount += harvester.getHarvestStatistics().getHarvestCount();
+= harvester.getHarvestStatistics().getHarvestDuration();
} }
return harvestCount; return harvestCount;