sofya.graphs.irg
Class IRG.ClassNode

java.lang.Object
  extended by sofya.graphs.irg.IRG.ClassNode
Enclosing class:
IRG

public static class IRG.ClassNode
extends java.lang.Object

This class represents a node in the IRG which encapsulates the interclass relations for a particular class.

A node records the name of a class, its superclass, subclasses, implementors (for interfaces), and classes which use it (if computation of uses is enabled). To reduce memory footprint all of these references are stored as numeric indices, and the node retains a shallow reference to the name table of the enclosing graph for resolving the names.


Constructor Summary
protected IRG.ClassNode(int name, int superclass)
          Constructs a partially initialized class relations node.
protected IRG.ClassNode(int name, int superclass, gnu.trove.TIntArrayList subclasses, gnu.trove.TIntArrayList implementors, gnu.trove.TIntArrayList users, java.lang.String[] nameTable)
          Constructs a class relations node.
 
Method Summary
 int getImplementorCount()
          Gets the number of classes implementing this node's interface.
 java.lang.String[] getImplementors()
          Gets a list of the names of classes implementing this node's interface.
 java.lang.String getName()
          Gets the name of the class represented by this node.
 int getSubclassCount()
          Gets the number of subclasses of this node's class.
 java.lang.String[] getSubclasses()
          Gets a list of the names of subclasses of this node's class.
 java.lang.String getSuperclass()
          Gets the superclass of this node's class.
 int getUserCount()
          Gets the number of classes using this node's class.
 java.lang.String[] getUsers()
          Gets a list of the names of classes which use this node's class.
 java.util.Iterator implementorIterator()
          Returns an iterator over the names of the implementors of this node's interface.
 java.util.Iterator subclassIterator()
          Returns an iterator over the names of the subclasses of this node's class.
 java.util.Iterator userIterator()
          Returns an iterator over the names of the users of this node's class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IRG.ClassNode

protected IRG.ClassNode(int name,
                        int superclass)
Constructs a partially initialized class relations node.

This is intended for internal use during IRG construction; it enables nodes to be aggressively created when classes reveal dependencies on other classes not yet analyzed. This in turn enables a more efficient single pass analysis.

Parameters:
name - Index to the name table entry containing the name of the class represented by this node.
superclass - Index to the name table entry containing the name of the superclass of this node's class.

IRG.ClassNode

protected IRG.ClassNode(int name,
                        int superclass,
                        gnu.trove.TIntArrayList subclasses,
                        gnu.trove.TIntArrayList implementors,
                        gnu.trove.TIntArrayList users,
                        java.lang.String[] nameTable)
Constructs a class relations node.

Parameters:
name - Index to the name table entry containing the name of the class represented by this node.
superclass - Index to the name table entry containing the name of the superclass of this node's class.
subclasses - List of name table indexes for the subclasses of this node's class.
implementors - List of name table indexes to classes implementing this node's interface (will be empty for concrete (classes).
users - List of name table indexes to classes which use this node's class.
nameTable - Reference to the name table of the containing IRG, used to resolve names.
Method Detail

getName

public java.lang.String getName()
Gets the name of the class represented by this node.

Returns:
This node's class name.

getSuperclass

public java.lang.String getSuperclass()
Gets the superclass of this node's class.

Returns:
The superclass of this class.

getSubclasses

public java.lang.String[] getSubclasses()
Gets a list of the names of subclasses of this node's class.

Returns:
The list of this class's subclasses.

getImplementors

public java.lang.String[] getImplementors()
Gets a list of the names of classes implementing this node's interface.

Returns:
The list of classes implementing this class's interface. This list will be empty if the node does not represent an interface.

getUsers

public java.lang.String[] getUsers()
Gets a list of the names of classes which use this node's class.

Returns:
The list of classes which use this class.

getSubclassCount

public int getSubclassCount()
Gets the number of subclasses of this node's class.

Returns:
Number of subclasses of this class.

getImplementorCount

public int getImplementorCount()
Gets the number of classes implementing this node's interface.

Returns:
Number of classes implementing this interface (0 if the node does not represent an interface).

getUserCount

public int getUserCount()
Gets the number of classes using this node's class.

Returns:
Number of classes which use this class (0 if the IRG is not compiled to collect use information).

subclassIterator

public java.util.Iterator subclassIterator()
Returns an iterator over the names of the subclasses of this node's class.

Returns:
A (read-only) iterator over the names of this class's subclasses.

implementorIterator

public java.util.Iterator implementorIterator()
Returns an iterator over the names of the implementors of this node's interface.

Returns:
A (read-only) iterator over the names of classes implementing this interface, which will return no elements if this node does not represent an interface.

userIterator

public java.util.Iterator userIterator()
Returns an iterator over the names of the users of this node's class.

Returns:
A (read-only) iterator over the names of classes which use this class, which will return no elements if the IRG is not compiled to collect use information.