1 17 package org.apache.ws.jaxme.xs.xml.impl; 18 19 import java.util.ArrayList ; 20 import java.util.List ; 21 22 import org.apache.ws.jaxme.xs.xml.*; 23 24 25 45 public class XsGParticleImpl implements XsGParticle { 46 private final XsObject owner; 47 private List particles; 48 49 protected XsGParticleImpl(XsObject pOwner) { 50 owner = pOwner; 51 } 52 53 protected void addParticle(XsTParticle pParticle) { 54 if (particles == null) { 55 particles = new ArrayList (); 56 } 57 particles.add(pParticle); 58 } 59 60 public XsTLocalElement createElement() { 61 XsTLocalElement element = owner.getObjectFactory().newXsTLocalElement(owner); 62 addParticle(element); 63 return element; 64 } 65 66 public XsTGroupRef createGroup() { 67 XsTGroupRef groupRef = owner.getObjectFactory().newXsTGroupRef(owner); 68 addParticle(groupRef); 69 return groupRef; 70 } 71 72 public XsTAll createAll() { 73 XsTAll all = owner.getObjectFactory().newXsTAll(owner); 74 addParticle(all); 75 return all; 76 } 77 78 public XsESequence createSequence() { 79 XsESequence sequence = owner.getObjectFactory().newXsESequence(owner); 80 addParticle(sequence); 81 return sequence; 82 } 83 84 public XsEChoice createChoice() { 85 XsEChoice choice = owner.getObjectFactory().newXsEChoice(owner); 86 addParticle(choice); 87 return choice; 88 } 89 90 public XsEAny createAny() { 91 XsEAny any = owner.getObjectFactory().newXsEAny(owner); 92 addParticle(any); 93 return any; 94 } 95 96 public XsTParticle[] getParticles() { 97 if (particles == null) { 98 return new XsTParticle[0]; 99 } else { 100 return (XsTParticle[]) particles.toArray(new XsTParticle[particles.size()]); 101 } 102 } 103 } 104 | Popular Tags |