1 /*2 * The contents of this file are subject to the terms of the Common Development3 * and Distribution License (the License). You may not use this file except in4 * compliance with the License.5 * 6 * You can obtain a copy of the License at http://www.netbeans.org/cddl.html7 * or http://www.netbeans.org/cddl.txt.8 * 9 * When distributing Covered Code, include this CDDL Header Notice in each file10 * and include the License file at http://www.netbeans.org/cddl.txt.11 * If applicable, add the following below the CDDL Header, with the fields12 * enclosed by brackets [] replaced by your own identifying information:13 * "Portions Copyrighted [year] [name of copyright owner]"14 * 15 * The Original Software is NetBeans. The Initial Developer of the Original16 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun17 * Microsystems, Inc. All Rights Reserved.18 */19 20 package org.netbeans.modules.xml.xpath.visitor;21 22 import java.util.Collection ;23 import java.util.Iterator ;24 25 import org.netbeans.modules.xml.xpath.LocationStep;26 import org.netbeans.modules.xml.xpath.XPathCoreFunction;27 import org.netbeans.modules.xml.xpath.XPathCoreOperation;28 import org.netbeans.modules.xml.xpath.XPathExpression;29 import org.netbeans.modules.xml.xpath.XPathExpressionPath;30 import org.netbeans.modules.xml.xpath.XPathExtensionFunction;31 import org.netbeans.modules.xml.xpath.XPathLocationPath;32 import org.netbeans.modules.xml.xpath.XPathNumericLiteral;33 import org.netbeans.modules.xml.xpath.XPathOperationOrFuntion;34 import org.netbeans.modules.xml.xpath.XPathPredicateExpression;35 import org.netbeans.modules.xml.xpath.XPathStringLiteral;36 import org.netbeans.modules.xml.xpath.XPathVariableReference;37 38 39 /**40 * 41 * @author radval42 *43 */44 public abstract class AbstractXPathVisitor implements XPathVisitor {45 46 public void visit(LocationStep locationStep) {47 }48 49 public void visit(XPathCoreFunction coreFunction) {50 }51 52 public void visit(XPathCoreOperation coreOperation) {53 }54 55 public void visit(XPathExpressionPath expressionPath) {56 }57 58 public void visit(XPathExtensionFunction extensionFunction) {59 }60 61 public void visit(XPathLocationPath locationPath) {62 }63 64 public void visit(XPathNumericLiteral numericLiteral) {65 }66 67 public void visit(XPathStringLiteral stringLiteral) {68 }69 70 public void visit(XPathVariableReference vReference) {71 }72 73 74 public void visit(XPathPredicateExpression predicate) {75 XPathExpression predicateExpression = predicate.getPredicate();76 if(predicateExpression != null) {77 predicateExpression.accept(this);78 }79 }80 81 protected void visitChildren(XPathOperationOrFuntion expr) {82 Collection children = expr.getChildren();83 if(children != null) {84 Iterator it = children.iterator();85 while(it.hasNext()) {86 XPathExpression child = (XPathExpression) it.next();87 child.accept(this);88 89 }90 }91 }92 93 }94