InputType
- The type of input to the categorizer. It is the type of input to the
preprocessor.IntermediateType
- The type of the intermediate values for the categorizer. It is the type
of the output of the preprocessor and the input of the internal
categorizer.CategoryType
- The type of the output of the categorizer. It is the type of the output
of the internal categorizer as well.public class CompositeCategorizer<InputType,IntermediateType,CategoryType> extends AbstractCloneableSerializable implements Categorizer<InputType,CategoryType>
Modifier and Type | Field and Description |
---|---|
protected Categorizer<? super IntermediateType,? extends CategoryType> |
categorizer
The categorizer.
|
protected Evaluator<? super InputType,? extends IntermediateType> |
preprocessor
The preprocessor for the input data.
|
Constructor and Description |
---|
CompositeCategorizer()
Creates a new CompositeCategorizer with the preprocessor and categorizer
set to null.
|
CompositeCategorizer(Evaluator<? super InputType,? extends IntermediateType> preprocessor,
Categorizer<? super IntermediateType,? extends CategoryType> categorizer)
Creates a new
CompositeCategorizer . |
Modifier and Type | Method and Description |
---|---|
CompositeCategorizer<InputType,IntermediateType,CategoryType> |
clone()
This makes public the clone method on the
Object class and
removes the exception that it throws. |
CategoryType |
evaluate(InputType input)
Evaluates the function on the given input and returns the output.
|
java.util.Set<? extends CategoryType> |
getCategories()
Gets the set of categories, which is just the set returned by the
categorizer.
|
Categorizer<? super IntermediateType,? extends CategoryType> |
getCategorizer()
Gets the categorizer, which takes the output of the preprocessor and
categorizes it.
|
Evaluator<? super InputType,? extends IntermediateType> |
getPreprocessor()
Gets the preprocessor, which takes the input and produces an intermediate
value that is then passed to the categorizer.
|
void |
setCategorizer(Categorizer<? super IntermediateType,? extends CategoryType> categorizer)
Sets the categorizer, which takes the output of the preprocessor and
categorizes it.
|
void |
setPreprocessor(Evaluator<? super InputType,? extends IntermediateType> preprocessor)
Sets the preprocessor, which takes the input and produces an intermediate
value that is then passed to the categorizer.
|
protected Evaluator<? super InputType,? extends IntermediateType> preprocessor
protected Categorizer<? super IntermediateType,? extends CategoryType> categorizer
public CompositeCategorizer()
public CompositeCategorizer(Evaluator<? super InputType,? extends IntermediateType> preprocessor, Categorizer<? super IntermediateType,? extends CategoryType> categorizer)
CompositeCategorizer
.preprocessor
- The preprocessing evaluator that is run on the input.categorizer
- The categorizer that takes the output of the preprocessor and
categorizes it.public CompositeCategorizer<InputType,IntermediateType,CategoryType> clone()
AbstractCloneableSerializable
Object
class and
removes the exception that it throws. Its default behavior is to
automatically create a clone of the exact type of object that the
clone is called on and to copy all primitives but to keep all references,
which means it is a shallow copy.
Extensions of this class may want to override this method (but call
super.clone()
to implement a "smart copy". That is, to target
the most common use case for creating a copy of the object. Because of
the default behavior being a shallow copy, extending classes only need
to handle fields that need to have a deeper copy (or those that need to
be reset). Some of the methods in ObjectUtil
may be helpful in
implementing a custom clone method.
Note: The contract of this method is that you must use
super.clone()
as the basis for your implementation.clone
in interface CloneableSerializable
clone
in class AbstractCloneableSerializable
public CategoryType evaluate(InputType input)
Evaluator
evaluate
in interface Evaluator<InputType,CategoryType>
input
- The input to evaluate.public java.util.Set<? extends CategoryType> getCategories()
getCategories
in interface Categorizer<InputType,CategoryType>
public Evaluator<? super InputType,? extends IntermediateType> getPreprocessor()
public void setPreprocessor(Evaluator<? super InputType,? extends IntermediateType> preprocessor)
preprocessor
- The preprocessor.public Categorizer<? super IntermediateType,? extends CategoryType> getCategorizer()
public void setCategorizer(Categorizer<? super IntermediateType,? extends CategoryType> categorizer)
categorizer
- The categorizer.