|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--AFLPcore.Manager
This class contains a list of Operation
s which can be used
to perform different functions in the program. Each op is associated with a
String
, which represents its name. The associations are
currently mantained in a hash table.
Both this class and Operation
are abstract and must be
extended. The op should be similar in some way, like
ImportFilter
which extends Operation
and
is an abstract class for filtering in input files. The
ImportMgr
is a subclass of this class and checks to see
that all of the Operations
are of type
ImportFilter
. Therefore, the only method that needs to
be implemented by a subclass is the classTypeOk
, which
checks to make sure that the operation is a valid one.
Classes that extend this class should call this classes constructor to set up the hashtable.
The ops can be retrieved based on their name, and a lists of names can be obtained from the Manager. The Op will contain addtional information.
Currently, ops can be added with methods, but ideally the
Manager would be able to analyze something like a directory and add
all of the ops it found there. This would mean that different operations
could be add by simply dropping a class that extended the appropriate
Operation
subclass into the appropriate directory.
Operation
,
Hashtable
,
ImportMgr
,
ImportFilter
Constructor Summary | |
Manager()
Creates a new Manager, with a default capacity of 4 and a loadFactor of 1.0. |
|
Manager(int capacity,
float loadFactor)
Creates a new Manager with the specified values. |
Method Summary | |
void |
add(java.lang.String name,
Operation operation)
Adds the specified operation with the given name
to the Manager. |
abstract boolean |
classTypeOk(Operation op)
Checks to see if the specified operation is compatible with the manager. |
Operation |
get(java.lang.String opName)
Retrieves the operation associated with the given name. |
Operation |
getDefault()
Gives the default operation for this manager. |
java.lang.String |
getDefaultName()
Gives the name of the default operation for this manager. |
java.lang.String[] |
getNames()
Gets the names of all of the Operations known to the Manager. |
void |
setDefault(java.lang.String name)
Sets the default operation to the one specified. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Manager()
public Manager(int capacity, float loadFactor) throws java.lang.IllegalArgumentException
capacity
- the initial number of operations that can be stored.loadFactor
- controls memory efficiency vs. lookup speed, it
must be between 0.0 and 1.0, where 1.0 has the greatest memory efficiencyjava.lang.IllegalArgumentException
- when capacitly
is less
than zero or the loadFactor
is out of bounds.Method Detail |
public java.lang.String[] getNames()
Enumeration
from the hash table.
The Enumeration
is turned into an array be simply
retrieveing the next element and storing it in an array. The size of
the hashtable becomes the size of the array.Enumeration
public Operation get(java.lang.String opName) throws java.util.NoSuchElementException
filterName
- the name of a filter known to this Managerjava.util.NoSuchElementException
- the specified operation does not exist
In other words, opName
does not have an associated
value.public void add(java.lang.String name, Operation operation) throws java.lang.IllegalArgumentException
operation
with the given name
to the Manager. The operation must be compatible with the type
of operation that this class handles.name
- the name of the operation to be associated with itoperation
- the operation objectjava.lang.IllegalArgumentException
- occurs when the given
operation is not compatible with the Manager.public abstract boolean classTypeOk(Operation op)
return (op instanceof ImportFilter);
true
if it is compatible, false
if
it is not.public void setDefault(java.lang.String name) throws java.util.NoSuchElementException
name
- the name of the operation to use as the default. If it is
null
, then no default method will be set and an
exception will be thrown when getDefault
is called.java.util.NoSuchElementException
- when the specified name is not
null
and does not match any filter known to the ImportMgr,
this will be thrown.public Operation getDefault()
null
if the default is not set.public java.lang.String getDefaultName()
null
if the default
is not set.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |