1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 package org.openoffice.xmerge.merger.diff;
25 
26 import org.w3c.dom.Node;
27 
28 import org.openoffice.xmerge.ConverterCapabilities;
29 import org.openoffice.xmerge.converter.xml.OfficeConstants;
30 import org.openoffice.xmerge.util.Resources;
31 
32 
33 /**
34  *  This is an implementation of the <code>Iterator</code> interface and extends
35  *  <code>NodeIterator</code>.  It will traverse the tree and find row sequences.
36  *
37  * @author smak
38  */
39 public final class RowIterator extends NodeIterator {
40 
41     private Resources res = Resources.getInstance();
42 
43     // TODO: should compare the ConverterCapabilities supported feature only!
44     // otherwise even though one with a chart, one without, will still be
45     // considered to be not equivalent.
46 
47     /**
48      *  Standard constructor.
49      *
50      *  @param  cc    The <code>ConverterCapabilities</code>.
51      *  @param  node  The initial root <code>Node</code>.
52      */
RowIterator(ConverterCapabilities cc, Node node)53     public RowIterator(ConverterCapabilities cc, Node node) {
54         super(cc, node);
55     }
56 
57     /**
58      *  Overwrite the parent <code>nodeSupported</code> method.  Only
59      *  row <code>Node</code> objects are supported.
60      *
61      *  @param  node  <code>Node</code> to check.
62      *
63      *  @return  true if the <code>Node</code> is supported, false otherwise.
64      */
nodeSupported(Node node)65     protected boolean nodeSupported(Node node) {
66 
67         // can use an array later to check all possible tags for
68         // future expansion
69         if (node.getNodeType() == Node.ELEMENT_NODE &&
70             node.getNodeName().equals(OfficeConstants.TAG_TABLE_ROW)) {
71             return true;
72         } else {
73             return false;
74         }
75     }
76 }
77 
78