retval.addElement(theFactory.createInstance (subobject, name));
Asset particle = theFactory.createInstance (subobject, name); Enumeration otherProps = asset.getOtherProperties(); while (otherProps.hasMoreElements()) { particle.addOtherPropertyGroup((PropertyGroup)otherProps.nextElement()); } retval.addElement(particle);
  public static Vector ExpandAsset(RootFactory theFactory, Asset asset) {    Vector retval = new Vector();    if (asset instanceof AssetGroup) {      AssetGroup group = (AssetGroup)asset;      Vector subobjects = group.getAssets();      for (int i=0; i<subobjects.size(); i++) {	Object subobject = subobjects.elementAt(i);	if (subobject instanceof AssetGroup ||	    subobject instanceof AggregateAsset) {	  Vector moreboxes = ExpandAsset(theFactory, (Asset)subobject);	  for (int j = 0; j < moreboxes.size(); j++)	    retval.addElement(moreboxes.elementAt(j));	} 	else{	  retval.addElement(subobject);	}      }    }     else if (asset instanceof AggregateAsset) {      AggregateAsset aggregate = (AggregateAsset) asset;      long count = aggregate.getQuantity();      Asset subobject = (Asset)aggregate.getAsset();      if (subobject instanceof AggregateAsset ||	  subobject instanceof AssetGroup) {	for (long i=0; i<count; i++) {	  Vector evenmoreboxes = ExpandAsset(theFactory, (Asset)subobject);	  for (int j = 0; j < evenmoreboxes.size(); j++)	    retval.addElement(evenmoreboxes.elementAt(j));	}       }      else if (subobject instanceof Asset) {	boolean tooBig = false;        PhysicalPG ppg =           (PhysicalPG) ((ALPAsset)subobject).getPhysicalPG();	if (ppg != null) {	  try {	    Volume vol  = ppg.getVolume();	    Area   area = ppg.getFootprintArea();	  	    if ((vol.getCubicFeet   () > MAX_CUBIC_FT) || 		(area.getSquareFeet () > MAX_SQ_FT))	      tooBig = true;	  } catch (Exception e) {	    System.out.println ("GLMAsset.ExpandAsset - ERROR : " +				"aggregate asset\n\t" + aggregate + 				"\n\thas asset\n\t" +				subobject + 				"\n\tthat has no physicalPG.");	  }	}	if (tooBig)	  for (long i=0; i<count; i++) {	    String name = getTypeName (subobject);	    if (name.length () > 10)		name = name.substring (0, 9) + "...";	    name = name + "-" + 	      (i+1) + "_of_" + 	      count + "(" + 	      getLatestUID () + ")";	    retval.addElement(theFactory.createInstance (subobject, name));	  }	else	  retval.addElement (asset);      }      else {	System.out.println ("GLMAsset.ExpandAsset - ERROR : " +			    "aggregate asset\n\t" + aggregate + 			    "\n\thas asset\n\t" +			    subobject + 			    "\n\tthat is not an Asset.");	retval.addElement (asset);      }    }     else{      retval.addElement(asset);    }        return retval;  }