Package weka.core
Class ClassCache
java.lang.Object
weka.core.ClassCache
- All Implemented Interfaces:
RevisionHandler
A singleton that stores all classes on the classpath.
- Version:
- $Revision: 14791 $
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classFor filtering classes.static classFor filtering classes. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringthe key for the default package.static final booleanwhether to output some debug information. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanAdds the classname to the cache.static StringFixes the classname, turns "/" and "\" into "." and removes ".class".static StringextractPackage(String classname) Extracts the package name from the (clean) classname.Find all classes that have the supplied matchText String in their suffix.getClassnames(String pkgname) Returns all the classes for the given package.Returns the revision string.static voidFor testing only.packages()Returns all the stored packages.booleanRemoves the classname from the cache.
-
Field Details
-
VERBOSE
public static final boolean VERBOSEwhether to output some debug information.- See Also:
-
DEFAULT_PACKAGE
the key for the default package.- See Also:
-
-
Constructor Details
-
ClassCache
public ClassCache()Initializes the cache.
-
-
Method Details
-
cleanUp
Fixes the classname, turns "/" and "\" into "." and removes ".class".- Parameters:
classname- the classname to process- Returns:
- the processed classname
-
extractPackage
Extracts the package name from the (clean) classname.- Parameters:
classname- the classname to extract the package from- Returns:
- the package name
-
add
Adds the classname to the cache.- Parameters:
classname- the classname, automatically removes ".class" and turns "/" or "\" into "."- Returns:
- true if adding changed the cache
-
remove
Removes the classname from the cache.- Parameters:
classname- the classname to remove- Returns:
- true if the removal changed the cache
-
packages
Returns all the stored packages.- Returns:
- the package names
-
getClassnames
Returns all the classes for the given package.- Parameters:
pkgname- the package to get the classes for- Returns:
- the classes (sorted by name)
-
find
Find all classes that have the supplied matchText String in their suffix.- Parameters:
matchText- the text to match- Returns:
- an array list of matching fully qualified class names.
-
getRevision
Returns the revision string.- Specified by:
getRevisionin interfaceRevisionHandler- Returns:
- the revision
-
main
For testing only.- Parameters:
args- ignored
-