1 28 29 package com.caucho.xml; 30 31 import java.io.IOException ; 32 import java.util.ArrayList ; 33 34 37 class QContentParticle { 38 ArrayList <Object > _children = new ArrayList <Object >(); 39 int _separator; 40 int _repeat; 41 42 void addChild(Object child) 43 { 44 _children.add(child); 45 } 46 47 50 public int getChildSize() 51 { 52 return _children.size(); 53 } 54 57 public Object getChild(int index) 58 { 59 return _children.get(index); 60 } 61 64 public void setChild(int index, Object child) 65 { 66 _children.set(index, child); 67 } 68 69 public void print(XmlPrinter os) throws IOException 70 { 71 os.print("("); 72 73 for (int i = 0; i < _children.size(); i++) { 74 if (i != 0) { 75 if (_separator == ',') 76 os.print(", "); 77 else { 78 os.print(" "); 79 os.print((char) _separator); 80 os.print(" "); 81 } 82 } 83 84 Object child = _children.get(i); 85 86 if (child instanceof QContentParticle) 87 ((QContentParticle) child).print(os); 88 else 89 os.print(String.valueOf(child)); 90 } 91 92 os.print(")"); 93 if (_repeat != 0) 94 os.print((char) _repeat); 95 } 96 } 97 | Popular Tags |