org.jtool.jxplatform.wrapper
Class JxFile

java.lang.Object
  extended byorg.jtool.jxplatform.wrapper.JxElement
      extended byorg.jtool.jxplatform.wrapper.JxFile
Direct Known Subclasses:
JxBinaryFile

public class JxFile
extends JxElement

An object wrapping the File element.

Author:
Katsuhisa Maruyama

Field Summary
protected  org.w3c.dom.Element[] classElems
          Elements of classes defined in this file.
protected  JxClassList classes
          Classes and interfaces defined in this file.
protected  java.lang.String[] importNames
          The names of packeges and classes imported by this file.
protected  org.w3c.dom.Element[] interfaceElems
          Elements of interfaces defined in this file.
protected  java.lang.String packageName
          The name of a package where this file exists in.
protected  java.lang.String pathName
          The pathname of this file.
 
Fields inherited from class org.jtool.jxplatform.wrapper.JxElement
element
 
Constructor Summary
protected JxFile()
          Creates a new, empty object.
protected JxFile(org.w3c.dom.Element elem)
          Creates a new object wrapping a File element.
 
Method Summary
 boolean enclose(org.w3c.dom.Element elem)
          Tests if this file element encloses a given element.
 boolean equals(JxFile jfile)
          Tests if a given file wrapper equals to this one.
 org.w3c.dom.Element[] getAllClassAndInterfaceElements()
          Returns the elements of all class and interface declarations contained in this file.
 org.w3c.dom.Element[] getAllClassElements()
          Returns the elements of all class declarations contained in this file.
 org.w3c.dom.Element[] getAllImportElements()
          Returns an array of import declaration elements of this file.
 org.w3c.dom.Element[] getAllInterfaceElements()
          Returns the elements of all interface declarations contained in this file.
 JxClassList getAllJxClasses()
          Returns the wrapper list of all classes and interfaces within this file.
 java.lang.String getDirName()
          Returns the directory name in which this file exists.
static org.w3c.dom.Element getFileElement(org.w3c.dom.Element elem)
          Returns the File element containing a given element.
 java.lang.String[] getImportNames()
          Returns an array of import names of this file.
 JxClass getJxClass()
          Obtains a class wrapper defining this file element.
 JxClass getJxClass(java.lang.String name)
          Returns a wrapper for a class with a given name.
 org.w3c.dom.Element getJxClassById(java.lang.String id)
          Returns the element for a class with a given name.
 JxMethod getJxMethod()
          Obtains a method wrapper defining this file element.
 java.lang.String getName()
          Returns the name of this file.
 org.w3c.dom.Element getPackageElement()
          Returns the package declaration element of this file.
 java.lang.String getPackageName()
          Returns the package name of this file.
 java.lang.String getPathName()
          Returns the path name of this file.
 java.lang.String getProjectName()
          Returns the project name of this file.
 java.lang.String[] getReferencedFileNames()
          Obtains the array of the filenames of all classes and interfaces referenced by this file.
 java.lang.String[] getReferencedTypeNames()
          Obtains the array of the fully qualified names of all the classes and interfaces referenced by this file.
static boolean isFile(org.w3c.dom.Element elem)
          Tests if a given element is the File element.
 void print()
          Displays information about this file wrapper for debugging.
 
Methods inherited from class org.jtool.jxplatform.wrapper.JxElement
equals, existInTheSameClass, existInTheSameField, existInTheSameFile, existInTheSameMethod, existsInTheSameClass, existsInTheSameFile, existsInTheSameMethod, existsInTheSamePackage, getArrayOfElements, getChildElement, getChildElement, getChildElements, getChildElements, getChildNodes, getChildNodes, getClassElement, getDescendantElements, getDescendantElements, getDescendantElements, getDescendantElements, getElement, getElementById, getExpressionElements, getFieldElement, getFileElement, getFirstChildElement, getFirstChildElement, getId, getId, getIdentName, getIdentName, getJxField, getJxFile, getJxStaticInit, getKeyword, getLine, getMethodElement, getStatementElement, getStaticInitElement, getTypeElement, getTypeElements, getTypeName, indexOf, indexOf, isBinary, isClass, isClassOrInterface, isConstructor, isExpression, isField, isFile, isImport, isInterface, isInTheSameField, isLocal, isMethod, isMethodOrConstructor, isPackage, isParameter, isStatement, isStaticInit, isTerminalElement, isType, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

pathName

protected java.lang.String pathName
The pathname of this file.


packageName

protected java.lang.String packageName
The name of a package where this file exists in.


importNames

protected java.lang.String[] importNames
The names of packeges and classes imported by this file.


classElems

protected org.w3c.dom.Element[] classElems
Elements of classes defined in this file.


interfaceElems

protected org.w3c.dom.Element[] interfaceElems
Elements of interfaces defined in this file.


classes

protected JxClassList classes
Classes and interfaces defined in this file.

Constructor Detail

JxFile

protected JxFile()
Creates a new, empty object.


JxFile

protected JxFile(org.w3c.dom.Element elem)
          throws JxWrapperException
Creates a new object wrapping a File element.

Parameters:
elem - An DOM element to be wrapped.
Throws:
JxWrapperException - if the specified element is not valid.
Method Detail

getPathName

public java.lang.String getPathName()
Returns the path name of this file.

Returns:
The path name string.

getName

public java.lang.String getName()
Returns the name of this file.

Returns:
The filename string.

getDirName

public java.lang.String getDirName()
Returns the directory name in which this file exists.

Returns:
The directory name string.

getProjectName

public java.lang.String getProjectName()
Returns the project name of this file.

Returns:
The project name.

isFile

public static boolean isFile(org.w3c.dom.Element elem)
Tests if a given element is the File element.

Parameters:
elem - An element of the DOM.
Returns:
if the element is the File, otherwise false.

getFileElement

public static org.w3c.dom.Element getFileElement(org.w3c.dom.Element elem)
Returns the File element containing a given element.

Parameters:
elem - An element of the DOM.
Returns:
The File element, or null if there is no such element.

equals

public boolean equals(JxFile jfile)
Tests if a given file wrapper equals to this one.

Parameters:
jfile - A file wrapper.
Returns:
true if the file wrapper equals to this one.

enclose

public boolean enclose(org.w3c.dom.Element elem)
Tests if this file element encloses a given element.

Parameters:
elem - An element of the DOM.
Returns:
true if this element encloses the element, otherwise false.

getPackageElement

public org.w3c.dom.Element getPackageElement()
Returns the package declaration element of this file.

Returns:
The Package element, null if there is no package declaration element.

getPackageName

public java.lang.String getPackageName()
Returns the package name of this file.

Returns:
The package name string, the empty string if the element is contained in the default package. null if there is no file containing the element.

getAllImportElements

public org.w3c.dom.Element[] getAllImportElements()
Returns an array of import declaration elements of this file.

Returns:
The array of the Import elements. The size of the array equals to 0 if there is no import declaration element.

getImportNames

public java.lang.String[] getImportNames()
Returns an array of import names of this file.

Returns:
The array of the import names. The size of the array equals to 0 if there is no import declaration element, or null.

getAllClassElements

public org.w3c.dom.Element[] getAllClassElements()
Returns the elements of all class declarations contained in this file.

Returns:
The array of the Class elements.

getAllInterfaceElements

public org.w3c.dom.Element[] getAllInterfaceElements()
Returns the elements of all interface declarations contained in this file.

Returns:
The array of the Intf elements.

getAllClassAndInterfaceElements

public org.w3c.dom.Element[] getAllClassAndInterfaceElements()
Returns the elements of all class and interface declarations contained in this file.

Returns:
The array of the Class and Intf elements.

getAllJxClasses

public JxClassList getAllJxClasses()
                            throws JxWrapperException
Returns the wrapper list of all classes and interfaces within this file.

Returns:
The wrapper list of the classes and interfaces.
Throws:
JxWrapperException - if creation of the class wrapper fails.

getJxClass

public JxClass getJxClass(java.lang.String name)
Returns a wrapper for a class with a given name.

Parameters:
name - The fully-qualified or simple name of a class to be retrieved.
Returns:
The matched JxClass wrapper, null if there is no element found.

getJxClassById

public org.w3c.dom.Element getJxClassById(java.lang.String id)
Returns the element for a class with a given name.

Parameters:
id - The indetifier of a class to be retrieved.
Returns:
The matched DOM element, null if there is no element found.

getReferencedTypeNames

public java.lang.String[] getReferencedTypeNames()
Obtains the array of the fully qualified names of all the classes and interfaces referenced by this file.

Returns:
The array of the fully qualified names of the referenced classes and interfaces.

getReferencedFileNames

public java.lang.String[] getReferencedFileNames()
Obtains the array of the filenames of all classes and interfaces referenced by this file.

Returns:
The array of the filenames of the referenced classes and interfaces.

getJxClass

public JxClass getJxClass()
Obtains a class wrapper defining this file element.

Overrides:
getJxClass in class JxElement
Returns:
Always null.

getJxMethod

public JxMethod getJxMethod()
Obtains a method wrapper defining this file element.

Overrides:
getJxMethod in class JxElement
Returns:
Always null.

print

public void print()
Displays information about this file wrapper for debugging.