{
List toBeRemoved = new ArrayList();
for ( Iterator it = list.iterator(); it.hasNext(); )
{
BuildProjectTask buildProjectTask = (BuildProjectTask) it.next();
for ( Iterator it2 = list.iterator(); it2.hasNext(); )
{
BuildProjectTask task = (BuildProjectTask) it2.next();
// check if it's the same task
if ( buildProjectTask == task ||
buildProjectTask.getBuildDefinitionId() != task.getBuildDefinitionId() )
{
continue;
}
// ----------------------------------------------------------------------
// If this build is forces, don't remove it
// ----------------------------------------------------------------------
if ( task.getTrigger() == ContinuumProjectState.TRIGGER_FORCED )
{
continue;
}
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
long interval = task.getTimestamp() - buildProjectTask.getTimestamp();
if ( interval < requiredBuildInterval )
{
toBeRemoved.add( buildProjectTask );
}