Hi Sandy and All,
To implement the union funda in attributeGroup, I propose the following:
Case I: traversing local attributeGroup.
In this case, it is just a reference to an already declared
attributeGroup. So, get the index of the already declared attributeGroup and
return that index.
Case II: traversing global attributeGroup.
Here you may have to perform a union. So, maintain two arrays of int
viz. int[] fAttrIdx and int[] fAttrUseIdx. While traversing the content of
attributeGroup you may encounter in-line attr. declaration, attr. use,
attributeGroup1 ref. As and when you encounter in-line attr. or attr. use
populate the appropriate array. The moment you get an attributeGroup1 ref, get
the index of attributeGroup1. Traverse the arrays of attributeGroup1 and compare
it with these arrays and add the indices from attributeGroup1 arrays to these
arrays, if they don't already exist. Finally, these arrays will represent a
union of attributes and attribute uses. This will avoid depth traversal of
attributeGroup, if it has attributeGroup refs.
public class XSAttributeGroupDecl {
public String fAttrGroupName;
public int[] fAttrIdx;
public int[] fAttrUseIdx;
public int fAttrWildcardIdx;
public void clear() {
// clear the values
}
}
Point out, if something is wrong or if I have missed something.
Cheers,
Rahul.
Sun Microsystems, Inc.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]