try {
//If target supports Polymorphism objects,
//go through each polymorphism in the target
Target t = (Target) targets.getSequenceAt(i);
if (t instanceof AbstractComplexTarget) {
AbstractComplexTarget at = (AbstractComplexTarget) t;
Variant[] vars = at.getVariants();
Polymorphism[] polys = at.getPolys();
for (int p = 0, var = 0;p<polys.length;p++) {
int varSize = polys[p].getVariants().length;
if (varSize < 4) {
at.setVariant(vars[var]);
break;
}
var+=vars[var].getVariantGroup().length;
}
}