sofya.base
Class ProgramUnit

java.lang.Object
  extended by sofya.base.ProgramUnit

public class ProgramUnit
extends java.lang.Object

Encapsulates information about a set of classes constituting a portion of a program. Typically used to identify classes contained in jar files and/or specified in 'prog' files.

Version:
06/01/2005
Author:
Alex Kinneer

Field Summary
 java.util.List classes
          The classes associated with this program unit.
 boolean isJar
          Flag specifying whether the location field points to a jar file.
 java.lang.String location
          The location where class files associated with this program unit can be found.
 boolean useLocation
          Flag specifying whether the location field should be considered valid.
 
Constructor Summary
ProgramUnit()
          Creates a default program unit.
ProgramUnit(java.lang.String location)
          Creates a program unit to specify classes at a specific location.
ProgramUnit(java.lang.String location, boolean useLocation, boolean isJar, java.util.List classes)
          Creates a program unit to specify classes at a specific location with particular characteristics.
 
Method Summary
 void addClass(java.lang.String className)
          Adds a class to this program unit.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

location

public final java.lang.String location
The location where class files associated with this program unit can be found.


classes

public final java.util.List classes
The classes associated with this program unit.


useLocation

public final boolean useLocation
Flag specifying whether the location field should be considered valid. If false, tools should assume that entries in the class list may already include path information.


isJar

public final boolean isJar
Flag specifying whether the location field points to a jar file.

Constructor Detail

ProgramUnit

public ProgramUnit()
Creates a default program unit.

The location field will be null, the useLocation field set to false, and the isJar field set to false.

This constructor is typically used to create a "default" program unit which contains the class names specified as arguments to a tool. Some tools prefer to process such entries directly and should be able to accommodate entries which already have associated path information.


ProgramUnit

public ProgramUnit(java.lang.String location)
Creates a program unit to specify classes at a specific location.

The isJar field is automatically set by parsing the provided location field. The location field is always set to true by this constructor.

Parameters:
location - Name of the directory or jar file which constitutes this program unit.

ProgramUnit

public ProgramUnit(java.lang.String location,
                   boolean useLocation,
                   boolean isJar,
                   java.util.List classes)
Creates a program unit to specify classes at a specific location with particular characteristics.

This constructor is primarily intended to be used for deserialization.

Parameters:
location - Name of the directory or jar file which constitutes this program unit.
useLocation - Flag specifying whether the location should be considered valid.
isJar - Flag specifying whether the location points to a jar file.
classes - List of classes constituting the program unit.
Method Detail

addClass

public void addClass(java.lang.String className)
Adds a class to this program unit.

Parameters:
className - Name of the class to be added to this program unit.