View Javadoc

1   /*
2    * Copyright 2001-2004 (C) MetaStuff, Ltd. All Rights Reserved.
3    * 
4    * This software is open source. 
5    * See the bottom of this file for the licence.
6    * 
7    * $Id: ElementIterator.java,v 1.6 2004/06/25 08:03:41 maartenc Exp $
8    */
9   
10  package org.dom4j.tree;
11  
12  import java.util.Iterator;
13  
14  import org.dom4j.Element;
15  
16  /*** <p><code>ElementIterator</code> is a filtering {@link Iterator} which 
17    * filters out objects which do not implement the {@link Element} 
18    * interface.</p>
19    *
20    * @author <a href="mailto:james.strachan@metastuff.com">James Strachan</a>
21    * @version $Revision: 1.6 $
22    * @deprecated  THIS CLASS WILL BE REMOVED IN dom4j-1.6 !!
23    */
24  public class ElementIterator extends FilterIterator {
25      
26      public ElementIterator(Iterator proxy) {
27          super(proxy);
28      }
29  
30  
31      /*** @return true if the given element implements the {@link Element} 
32        * interface
33        */
34      protected boolean matches(Object element) {
35          return element instanceof Element;
36      }
37  }
38  
39  
40  
41  
42  /*
43   * Redistribution and use of this software and associated documentation
44   * ("Software"), with or without modification, are permitted provided
45   * that the following conditions are met:
46   *
47   * 1. Redistributions of source code must retain copyright
48   *    statements and notices.  Redistributions must also contain a
49   *    copy of this document.
50   *
51   * 2. Redistributions in binary form must reproduce the
52   *    above copyright notice, this list of conditions and the
53   *    following disclaimer in the documentation and/or other
54   *    materials provided with the distribution.
55   *
56   * 3. The name "DOM4J" must not be used to endorse or promote
57   *    products derived from this Software without prior written
58   *    permission of MetaStuff, Ltd.  For written permission,
59   *    please contact dom4j-info@metastuff.com.
60   *
61   * 4. Products derived from this Software may not be called "DOM4J"
62   *    nor may "DOM4J" appear in their names without prior written
63   *    permission of MetaStuff, Ltd. DOM4J is a registered
64   *    trademark of MetaStuff, Ltd.
65   *
66   * 5. Due credit should be given to the DOM4J Project - 
67   *    http://www.dom4j.org
68   *
69   * THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS
70   * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
71   * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
72   * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
73   * METASTUFF, LTD. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
74   * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
75   * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
76   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
77   * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
78   * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
79   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
80   * OF THE POSSIBILITY OF SUCH DAMAGE.
81   *
82   * Copyright 2001-2004 (C) MetaStuff, Ltd. All Rights Reserved.
83   *
84   * $Id: ElementIterator.java,v 1.6 2004/06/25 08:03:41 maartenc Exp $
85   */