286N/A/*
286N/A * reserved comment block
286N/A * DO NOT REMOVE OR ALTER!
286N/A */
286N/A/*
286N/A * Copyright 2001-2004 The Apache Software Foundation.
286N/A *
286N/A * Licensed under the Apache License, Version 2.0 (the "License");
286N/A * you may not use this file except in compliance with the License.
286N/A * You may obtain a copy of the License at
286N/A *
286N/A * http://www.apache.org/licenses/LICENSE-2.0
286N/A *
286N/A * Unless required by applicable law or agreed to in writing, software
286N/A * distributed under the License is distributed on an "AS IS" BASIS,
286N/A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
286N/A * See the License for the specific language governing permissions and
286N/A * limitations under the License.
286N/A */
286N/A/*
286N/A * $Id: TopLevelElement.java,v 1.5 2005/09/28 13:48:17 pvedula Exp $
286N/A */
286N/A
286N/Apackage com.sun.org.apache.xalan.internal.xsltc.compiler;
286N/A
286N/Aimport java.util.Vector;
286N/A
286N/Aimport com.sun.org.apache.bcel.internal.generic.InstructionList;
286N/Aimport com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator;
286N/Aimport com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
286N/Aimport com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator;
286N/Aimport com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
286N/Aimport com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
286N/Aimport com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util;
286N/A
286N/Aclass TopLevelElement extends SyntaxTreeNode {
286N/A
286N/A /*
286N/A * List of dependencies with other variables, parameters or
286N/A * keys defined at the top level.
286N/A */
286N/A protected Vector _dependencies = null;
286N/A
286N/A /**
286N/A * Type check all the children of this node.
286N/A */
286N/A public Type typeCheck(SymbolTable stable) throws TypeCheckError {
286N/A return typeCheckContents(stable);
286N/A }
286N/A
286N/A /**
286N/A * Translate this node into JVM bytecodes.
286N/A */
286N/A public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
286N/A ErrorMsg msg = new ErrorMsg(ErrorMsg.NOT_IMPLEMENTED_ERR,
286N/A getClass(), this);
286N/A getParser().reportError(FATAL, msg);
286N/A }
286N/A
286N/A /**
286N/A * Translate this node into a fresh instruction list.
286N/A * The original instruction list is saved and restored.
286N/A */
286N/A public InstructionList compile(ClassGenerator classGen,
286N/A MethodGenerator methodGen) {
286N/A final InstructionList result, save = methodGen.getInstructionList();
286N/A methodGen.setInstructionList(result = new InstructionList());
286N/A translate(classGen, methodGen);
286N/A methodGen.setInstructionList(save);
286N/A return result;
286N/A }
286N/A
286N/A public void display(int indent) {
286N/A indent(indent);
286N/A Util.println("TopLevelElement");
286N/A displayContents(indent + IndentIncrement);
286N/A }
286N/A
286N/A /**
286N/A * Add a dependency with other top-level elements like
286N/A * variables, parameters or keys.
286N/A */
286N/A public void addDependency(TopLevelElement other) {
286N/A if (_dependencies == null) {
286N/A _dependencies = new Vector();
286N/A }
286N/A if (!_dependencies.contains(other)) {
286N/A _dependencies.addElement(other);
286N/A }
286N/A }
286N/A
286N/A /**
286N/A * Get the list of dependencies with other top-level elements
286N/A * like variables, parameteres or keys.
286N/A */
286N/A public Vector getDependencies() {
286N/A return _dependencies;
286N/A }
286N/A
286N/A}