1 58 package org.apache.ecs; 59 60 import java.io.OutputStream ; 61 import java.io.PrintWriter ; 62 import java.util.Enumeration ; 63 import java.util.Vector ; 64 65 81 public class ElementContainer extends ConcreteElement implements Printable 82 { 83 87 private Vector ec = new Vector (2); 88 89 92 public ElementContainer() 93 { 94 } 95 96 99 public ElementContainer(Element element) 100 { 101 addElement(element); 102 } 103 104 108 public ElementContainer addElement(Element element) 109 { 110 ec.addElement(element); 111 return(this); 112 } 113 114 118 public ElementContainer addElement(String element) 119 { 120 ec.addElement(new StringElement(element)); 121 return(this); 122 } 123 124 127 public void output(OutputStream out) 128 { 129 Element element = null; 130 Enumeration data = ec.elements(); 131 while ( data.hasMoreElements() ) 132 { 133 element = (Element) data.nextElement(); 134 element.output(out); 135 } 136 } 137 138 141 public void output(PrintWriter out) 142 { 143 Element element = null; 144 Enumeration data = ec.elements(); 145 while ( data.hasMoreElements() ) 146 { 147 element = (Element) data.nextElement(); 148 element.output(out); 149 } 150 } 151 154 public Enumeration elements() 155 { 156 return ec.elements(); 157 } 158 } 159 | Popular Tags |