boolean foundMatch = false;
Iterator faultsIt = faults.iterator();
while (faultsIt.hasNext())
{
Fault fault = (Fault)faultsIt.next();
if (namesEqual(bindingFault.getName(), fault.getName()))
{
foundMatch = true;
break;
}
}
if (!foundMatch)
{
// We need to remove this BindingFault from the bindingFaults List
bindingFaults.remove(index);
index--;
}
}
// Remove any Faults which already exists in bindingFaults. What we
// have left are the Faults which needs newly created BindingFaults
List bindingFaultsNeeded = new ArrayList();
for (int index = 0; index < faults.size(); index++)
{
Fault fault = (Fault)faults.get(index);
boolean foundMatch = false;
Iterator bindingFaultsIt = bindingFaults.iterator();
while (bindingFaultsIt.hasNext())
{
BindingFault bindingFault = (BindingFault)bindingFaultsIt.next();
if (namesEqual(bindingFault.getName(), fault.getName()))
{
foundMatch = true;
break;
}
}
if (!foundMatch)
{
// We need to remove this BindingFault from the bindingFaults List
bindingFaultsNeeded.add(fault);
}
}
// bindingFaultsNeeded contains the needed BindingFault's we need to create
Iterator neededBindingFaultsIt = bindingFaultsNeeded.iterator();
while (neededBindingFaultsIt.hasNext())
{
Fault fault = (Fault)neededBindingFaultsIt.next();
BindingFault newBindingFault = factory.createBindingFault();
newBindingFault.setEFault(fault);
newBindingFault.setName(fault.getName());
bindingOperation.addBindingFault(newBindingFault);
}
// Create the contents for each BindingFault
Iterator faultContentIt = bindingOperation.getEBindingFaults().iterator();