01: /*
02: * The contents of this file are subject to the terms of the Common Development
03: * and Distribution License (the License). You may not use this file except in
04: * compliance with the License.
05: *
06: * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
07: * or http://www.netbeans.org/cddl.txt.
08: *
09: * When distributing Covered Code, include this CDDL Header Notice in each file
10: * and include the License file at http://www.netbeans.org/cddl.txt.
11: * If applicable, add the following below the CDDL Header, with the fields
12: * 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 Original
16: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
17: * Microsystems, Inc. All Rights Reserved.
18: */
19:
20: package org.netbeans.modules.xml.xpath.ext.visitor;
21:
22: import org.netbeans.modules.xml.xpath.ext.LocationStep;
23: import org.netbeans.modules.xml.xpath.ext.XPathCoreFunction;
24: import org.netbeans.modules.xml.xpath.ext.XPathCoreOperation;
25: import org.netbeans.modules.xml.xpath.ext.XPathExpression;
26: import org.netbeans.modules.xml.xpath.ext.XPathExpressionPath;
27: import org.netbeans.modules.xml.xpath.ext.XPathExtensionFunction;
28: import org.netbeans.modules.xml.xpath.ext.XPathLocationPath;
29: import org.netbeans.modules.xml.xpath.ext.XPathPredicateExpression;
30:
31: /**
32: *
33: * @author nk160297
34: */
35: public abstract class XPathModelTracerVisitor extends
36: XPathVisitorAdapter {
37:
38: @Override
39: public void visit(LocationStep locationStep) {
40: XPathPredicateExpression[] expressions = locationStep
41: .getPredicates();
42: if (expressions != null) {
43: for (XPathPredicateExpression expression : expressions) {
44: expression.accept(this );
45: }
46: }
47: }
48:
49: @Override
50: public void visit(XPathCoreFunction coreFunction) {
51: visitChildren(coreFunction);
52: }
53:
54: @Override
55: public void visit(XPathCoreOperation coreOperation) {
56: visitChildren(coreOperation);
57: }
58:
59: @Override
60: public void visit(XPathExtensionFunction extensionFunction) {
61: visitChildren(extensionFunction);
62: }
63:
64: @Override
65: public void visit(XPathLocationPath locationPath) {
66: LocationStep[] steps = locationPath.getSteps();
67: if (steps != null) {
68: for (LocationStep step : steps) {
69: step.accept(this );
70: }
71: }
72: }
73:
74: @Override
75: public void visit(XPathExpressionPath expressionPath) {
76: XPathExpression expression = expressionPath.getRootExpression();
77: if (!expressionPath.equals(expression)) {
78: expression.accept(this );
79: }
80: LocationStep[] steps = expressionPath.getSteps();
81: if (steps != null) {
82: for (LocationStep step : steps) {
83: step.accept(this);
84: }
85: }
86: }
87:
88: }
|