1
/*******************************************************************************
2
* Copyright (c) 2007 Symbian Software Systems and others.
3
* All rights reserved. This program and the accompanying materials
4
* are made available under the terms of the Eclipse Public License v1.0
5
* which accompanies this distribution, and is available at
6
* http://www.eclipse.org/legal/epl-v10.html
9
* Andrew Ferguson (Symbian) - Initial implementation
10
*******************************************************************************/
11
package org.eclipse.cdt.internal.core.pdom.dom;
13
import org.eclipse.cdt.core.dom.IPDOMNode;
14
import org.eclipse.cdt.core.dom.IPDOMVisitor;
15
import org.eclipse.cdt.internal.core.pdom.db.IBTreeVisitor;
16
import org.eclipse.core.runtime.CoreException;
19
* Applies the specified visitor to the node being visited, and recursively to
20
* any nodes which act as containers
22
public class ApplyVisitor implements IBTreeVisitor, IPDOMVisitor {
23
protected PDOMLinkage linkage;
24
protected IPDOMVisitor visitor;
26
public ApplyVisitor(PDOMLinkage linkage, IPDOMVisitor visitor) {
27
this.linkage= linkage;
28
this.visitor= visitor;
31
public int compare(long record) throws CoreException {
32
return 0; // visit all nodes in a b-tree
35
public boolean visit(IPDOMNode node) throws CoreException {
36
if(node instanceof PDOMBinding) {
37
((PDOMBinding)node).accept(visitor);
38
((PDOMBinding)node).accept(this);
40
return false; // don't visit children of the node
43
public boolean visit(long record) throws CoreException {
46
PDOMNode node= linkage.getNode(record);
47
if(node instanceof PDOMBinding) {
48
((PDOMBinding)node).accept(visitor);
49
((PDOMBinding)node).accept(this);
54
public void leave(IPDOMNode node) throws CoreException {