The Tigris site will receive a major upgrade the evening of Monday, December 1, beginning at 8:30 pm PST. Downtime is projected to be about ten hours.
Further details in the announcement
jmt.codebase
Interface ClassName
- public interface ClassName
Describes a name of a class or interface.
A class name consists of the particular name, the packages the class
may belong to and the dimension of the instance.
When analysing a java-source while using an import statement
such as import java.util.*; the analysation code can't
be sure where to find a particular class like HashMap. The HashMap
class may be a member of the java.util package or a member of the
current package or even possible a member of the java.lang package
which every java-source imports automatically. This problem
leads to having more then one possible package for a given class.
A class name of a byte-source is definied using a string. The class name
has the schema of [[[package.name where [[[ indicates the number of
dimensions (here: 3), package is the name of the package the class
belongs to and name is the particular class name.
A package name of "" means the default package of a package
hierarchy.
A special function is the combine function. This function is used to
reflect the information gaining process while analysing more then one
class. Imagen a class importing the packages java.lang, java.util and
java.net and using the class HashMap. The HashMap has to be in the
current package, the java.lang package the java.util package
and the java.net package. If another class is analysed which also referres
to the HashMap class but only importing java.lang, java.util and
its current package differing from the package the former class is in then
the analysation logic will know that the HashMap class can only be
in the package java.lang or java.util, because both refer to the class and
both imports from the java.lang and java.util package.
The ClassName.combine(ClassName) method allows
to combine the package lists of two class names describing the same
class by simply compare both lists and creating a new package list
containing only the packages which are in both package lists.
Note: This behaviour is implemented and done by the ReferenceManager
used to keep track of all exsisting references used by a CodeBase instance.
- Author:
- Martin Kersten
- See Also:
AbstractClassName,
ClassNameFactory
|
Method Summary |
void |
combine(ClassName name)
Combines the packages with the packages of the other class.
|
int |
getDimension()
Returns the dimension of the array described by the ClassName
or zero if the ClassName does describe a single class or interface. |
java.lang.String |
getName()
Returns the name of the class. |
int |
getPackageCount()
Returns the count of the packages this class may belong to. |
java.lang.String[] |
getPackageNames()
Returns an array of the package names the class may belong to. |
boolean |
isArray()
Returns true if the class is an array
(dimension greater zero) otherwise false. |
boolean |
isSharingPackages(ClassName name)
Returns true if name shares at least one
package with this instance. |
boolean |
isType(ClassName name)
Returns true if the class name is of same type.
|
combine
public void combine(ClassName name)
- Combines the packages with the packages of the other class.
The combination of two package lists will only contain packages
belonging to both package lists.
If they don't share any packages nothing will happen.
Note: Only this
ClassName instance may change
it's package list.
- Parameters:
name - ClassName instance to compare packages with
getDimension
public int getDimension()
- Returns the dimension of the array described by the ClassName
or zero if the ClassName does describe a single class or interface.
- Returns:
- The dimension count
getName
public java.lang.String getName()
- Returns the name of the class.
- Returns:
- The name of the class
getPackageCount
public int getPackageCount()
- Returns the count of the packages this class may belong to.
- Returns:
- The package count
getPackageNames
public java.lang.String[] getPackageNames()
- Returns an array of the package names the class may belong to.
- Returns:
- The package name array
isArray
public boolean isArray()
- Returns
true if the class is an array
(dimension greater zero) otherwise false.
- Returns:
true if the class is an array otherwise false
isSharingPackages
public boolean isSharingPackages(ClassName name)
- Returns
true if name shares at least one
package with this instance.
- Parameters:
name - The name to test its packages with
- Returns:
true if name shares at least one package
isType
public boolean isType(ClassName name)
- Returns
true if the class name is of same type.
A name is of the same type when the names equals in
all points except the dimensions.
- Returns:
true if the class is same type.