Home | History | Annotate | Download | only in doc
      1 /* Copyright (C) 2003 Vladimir Roubtsov. All rights reserved.
      2  *
      3  * This program and the accompanying materials are made available under
      4  * the terms of the Common Public License v1.0 which accompanies this distribution,
      5  * and is available at http://www.eclipse.org/legal/cpl-v10.html
      6  *
      7  * $Id: ElementList.java,v 1.1.1.1 2004/05/09 16:57:41 vlad_r Exp $
      8  */
      9 package com.vladium.emma.report.html.doc;
     10 
     11 import java.util.ArrayList;
     12 import java.util.Iterator;
     13 import java.util.List;
     14 
     15 // ----------------------------------------------------------------------------
     16 /**
     17  * element list that is not necessarily an element itself
     18  *
     19  * @author Vlad Roubtsov, (C) 2003
     20  */
     21 public
     22 final class ElementList implements IElementList
     23 {
     24     // public: ................................................................
     25 
     26 
     27     public ElementList ()
     28     {
     29         m_contents = new ArrayList ();
     30     }
     31 
     32 
     33     public void emit (final HTMLWriter out)
     34     {
     35         for (Iterator c = m_contents.iterator (); c.hasNext (); )
     36         {
     37             final IContent content = (IContent) c.next ();
     38             content.emit (out);
     39         }
     40     }
     41 
     42     public IElementList add (final IContent content)
     43     {
     44         if (content != null)
     45         {
     46             m_contents.add (content);
     47         }
     48 
     49         return this;
     50     }
     51 
     52     public IElementList add (final int index, final IContent content)
     53     {
     54         if (content != null)
     55         {
     56             m_contents.add (index, content);
     57         }
     58 
     59         return this;
     60     }
     61 
     62     public int size ()
     63     {
     64         return m_contents.size ();
     65     }
     66 
     67     // protected: .............................................................
     68 
     69     // package: ...............................................................
     70 
     71     // private: ...............................................................
     72 
     73 
     74     private final List /* Content */ m_contents;
     75 
     76 } // end of class
     77 // ----------------------------------------------------------------------------