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: 14790 $
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
For filtering classes.static class
For filtering classes. -
Field Summary
Modifier and TypeFieldDescriptionstatic final String
the key for the default package.static final boolean
whether to output some debug information. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Adds the classname to the cache.static String
Fixes the classname, turns "/" and "\" into "." and removes ".class".static String
extractPackage
(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 void
For testing only.packages()
Returns all the stored packages.boolean
Removes 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:
getRevision
in interfaceRevisionHandler
- Returns:
- the revision
-
main
For testing only.- Parameters:
args
- ignored
-