/******************************************************************************* * Copyright © 2011, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation * *******************************************************************************/ package org.eclipse.edt.compiler.core.ast; import java.util.List; /** * UseStatement AST node type. * * @author Albert Ho * @author David Murray */ public class UseStatement extends Node { private List<Name> name_plus; // List of Names private SettingsBlock settingsBlockOpt; public UseStatement(List<Name> name_plus, SettingsBlock settingsBlockOpt, int startOffset, int endOffset) { super(startOffset, endOffset); this.name_plus = setParent(name_plus); if(settingsBlockOpt != null) { this.settingsBlockOpt = settingsBlockOpt; settingsBlockOpt.setParent(this); } } public List<Name> getNames() { return name_plus; } public boolean hasSettingsBlock() { return settingsBlockOpt != null; } public SettingsBlock getSettingsBlock() { return settingsBlockOpt; } public void accept(IASTVisitor visitor) { boolean visitChildren = visitor.visit(this); if(visitChildren) { acceptChildren(visitor, name_plus); if(settingsBlockOpt != null) settingsBlockOpt.accept(visitor); } visitor.endVisit(this); } protected Object clone() throws CloneNotSupportedException { SettingsBlock newSettingsBlockOpt = settingsBlockOpt != null ? (SettingsBlock)settingsBlockOpt.clone() : null; return new UseStatement(cloneList(name_plus), newSettingsBlockOpt, getOffset(), getOffset() + getLength()); } }