koala.dynamicjava.tree
Class ImportDeclaration

java.lang.Object
  extended by koala.dynamicjava.tree.Node
      extended by koala.dynamicjava.tree.ImportDeclaration
All Implemented Interfaces:
SourceInfo.Wrapper

public class ImportDeclaration
extends Node

This class represents the import declarations

Version:
1.0 - 1999/04/24
Author:
Stephane Hillion

Constructor Summary
ImportDeclaration(List<IdentifierToken> ident, boolean pkg, boolean sttc)
          Creates a new import declaration node
ImportDeclaration(List<IdentifierToken> ident, boolean pkg, boolean sttc, SourceInfo si)
          Creates a new import declaration node
ImportDeclaration(String nm, boolean pkg, boolean sttc, SourceInfo si)
          Creates a new import declaration node
 
Method Summary
<T> T
acceptVisitor(Visitor<T> visitor)
          Allows a visitor to traverse the tree
 String getName()
          Returns the name of the imported class or package
 boolean isPackage()
          Returns true if the identifier represents a package, false if it represents a class
 boolean isStatic()
          Returns true if the identifier represents a static import, false otherwise
 boolean isStaticImportClass()
          Returns true if the identifier represents a class whose methods are being statically imported, false if it represents a single method or if it is not a static import
 void setName(String s)
          Sets the package name
 void setPackage(boolean b)
          Sets the package property
 String toString()
          Implementation of toString for use in unit testing
 String toStringHelper()
           
 
Methods inherited from class koala.dynamicjava.tree.Node
archiveProperties, getProperties, getProperty, getSourceInfo, hasProperty, setProperty, setSourceInfo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ImportDeclaration

public ImportDeclaration(List<IdentifierToken> ident,
                         boolean pkg,
                         boolean sttc)
Creates a new import declaration node

Parameters:
ident - a list of tokens that represents a package or a class name
pkg - true if this declaration imports a package
sttc - true if this declaration is a static import
Throws:
IllegalArgumentException - if ident is null

ImportDeclaration

public ImportDeclaration(List<IdentifierToken> ident,
                         boolean pkg,
                         boolean sttc,
                         SourceInfo si)
Creates a new import declaration node

Parameters:
ident - a list of tokens that represents a package or a class name
pkg - true if this declaration imports a package
sttc - true if this declaration is a static import
Throws:
IllegalArgumentException - if ident is null

ImportDeclaration

public ImportDeclaration(String nm,
                         boolean pkg,
                         boolean sttc,
                         SourceInfo si)
Creates a new import declaration node

Parameters:
nm - a string that represents a package or a class name
pkg - true if this declaration imports a package
sttc - true if this declaration is a static import
Throws:
IllegalArgumentException - if ident is null
Method Detail

getName

public String getName()
Returns the name of the imported class or package


setName

public void setName(String s)
Sets the package name

Throws:
IllegalArgumentException - if s is null

isPackage

public boolean isPackage()
Returns true if the identifier represents a package, false if it represents a class


isStaticImportClass

public boolean isStaticImportClass()
Returns true if the identifier represents a class whose methods are being statically imported, false if it represents a single method or if it is not a static import


setPackage

public void setPackage(boolean b)
Sets the package property


isStatic

public boolean isStatic()
Returns true if the identifier represents a static import, false otherwise


acceptVisitor

public <T> T acceptVisitor(Visitor<T> visitor)
Allows a visitor to traverse the tree

Specified by:
acceptVisitor in class Node
Parameters:
visitor - the visitor to accept

toString

public String toString()
Implementation of toString for use in unit testing

Overrides:
toString in class Object

toStringHelper

public String toStringHelper()