{
XSTerm term = particle.getTerm();
if (term.getType() == XSConstants.MODEL_GROUP)
{
XSModelGroup modelGroup = (XSModelGroup)term;
XSObjectList particleList = modelGroup.getParticles();
if (particleList.getLength() > 1)
{
//inspect children
boolean bHasElement = hasElement(particle);
List modelGroupList = getModelGroups(particle);
//search for children that are model groups of type choice
for (int i = 0; i < modelGroupList.size(); i++)
{
XSParticle childParticle = (XSParticle)modelGroupList.get(i);
XSTerm childTerm = childParticle.getTerm();
assert childTerm.getType() == XSConstants.MODEL_GROUP;
if (bHasElement || modelGroupList.size() > 1 || bHasUncle)
{
XSModelGroup childModelGroup = (XSModelGroup)childTerm;
if (childModelGroup.getCompositor() == XSModelGroup.COMPOSITOR_CHOICE
&& (childParticle.getMaxOccursUnbounded() || childParticle.getMaxOccurs() > 1)
&& hasDescendantElements(childParticle, 1))
{
return true;
}
else if (childModelGroup.getCompositor() == XSModelGroup.COMPOSITOR_SEQUENCE)
{
//bHasUncle is set true because at least one of the following is true:
// 1. childModelGroup has a sibling element
// 2. childModelGroup has a sibling model group with a descendant element
// 3. childModelGroup has an uncle element or uncle model group with a descendant element