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