Class Registry
- java.lang.Object
-
- uk.ac.warwick.dcs.sherlock.engine.Registry
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ITuple<java.lang.Class<? extends IAdvancedPreProcessor>,java.lang.Class<? extends org.antlr.v4.runtime.Lexer>>getAdvancedPostProcessorForLanguage(java.lang.Class<? extends IAdvancedPreProcessorGroup> group, java.lang.String language)Fetches a tuple containing the correct AdvancedPreProcessor and Lexer implementations for this group/language combinationDetectionTypegetDetectionType(java.lang.String identifier)Fetches the DetectionType object for an identifier if it is presentjava.util.List<AdjustableParameterObj>getDetectorAdjustableParameters(java.lang.Class<? extends IDetector> det)Get the adjustable parameters for a detectorjava.lang.StringgetDetectorDescription(java.lang.Class<? extends IDetector> det)Get the description of a detectorjava.lang.StringgetDetectorDisplayName(java.lang.Class<? extends IDetector> det)Get the display name of the detectorjava.util.Set<java.lang.String>getDetectorLanguages(java.lang.Class<? extends IDetector> det)Get the languages supported by the detectorjava.util.Set<java.lang.Class<? extends IDetector>>getDetectors()Fetch the set of all detectors registered to Sherlockjava.util.Set<java.lang.Class<? extends IDetector>>getDetectors(java.lang.String language)Returns a set of all detectors registered which support the language specifiedjava.util.Set<java.lang.String>getLanguages()Returns the set of registered languagesjava.lang.Class<? extends org.antlr.v4.runtime.Lexer>getLexerForStrategy(PreProcessingStrategy strategy, java.lang.String language)Finds and returns a valid lexer for the preprocessing stragety, if one cannot be found returns nulljava.util.List<AdjustableParameterObj>getPostProcessorAdjustableParameters(java.lang.Class<? extends IPostProcessor> postProcessor)Gets the adjustable parameters for a postprocessorjava.util.List<AdjustableParameterObj>getPostProcessorAdjustableParametersFromDetector(java.lang.Class<? extends IDetector> det)Gets the adjustable parameters for the corresponding post processor for a detectorIPostProcessorgetPostProcessorInstance(java.lang.Class<? extends AbstractModelTaskRawResult> rawClass)Get correct instance of IPostProcessor to process an AbstractModelTaskRawResult objectbooleanregisterAdvancedPreProcessorGroup(java.lang.Class<? extends IAdvancedPreProcessorGroup> preProcessorGroup)Registers a grouping forIAdvancedPreProcessorto Sherlock.booleanregisterAdvancedPreProcessorImplementation(java.lang.String groupClassPath, java.lang.Class<? extends IAdvancedPreProcessor> preProcessor)Registers anIAdvancedPreProcessorimplementation to a groupbooleanregisterDetectionType(DetectionType detectionType)Registers a detection typebooleanregisterDetector(java.lang.Class<? extends IDetector> detector)Registers anIDetectorimplementation to Sherlock.booleanregisterGeneralPreProcessor(java.lang.Class<? extends IGeneralPreProcessor> preProcessor)Registers anIGeneralPreProcessorimplementation to SherlockbooleanregisterLanguage(java.lang.String name, java.lang.Class<? extends org.antlr.v4.runtime.Lexer> lexer)Register a lexer to the language of the name passed, creating the language if the name is not recognisedbooleanregisterPostProcessor(java.lang.Class<? extends IPostProcessor> postProcessor, java.lang.Class<? extends AbstractModelTaskRawResult> handledResultType)Registers anIPostProcessorimplementation to Sherlock, associates it with theAbstractModelTaskRawResulttypes it will process
-
-
-
Method Detail
-
getAdvancedPostProcessorForLanguage
public ITuple<java.lang.Class<? extends IAdvancedPreProcessor>,java.lang.Class<? extends org.antlr.v4.runtime.Lexer>> getAdvancedPostProcessorForLanguage(java.lang.Class<? extends IAdvancedPreProcessorGroup> group, java.lang.String language)
Fetches a tuple containing the correct AdvancedPreProcessor and Lexer implementations for this group/language combination- Specified by:
getAdvancedPostProcessorForLanguagein interfaceIRegistry- Parameters:
group- the group to find a valid preprocessor forlanguage- the language string in use, should have been already validated to work with this group- Returns:
- the tuple
-
getDetectionType
public DetectionType getDetectionType(java.lang.String identifier) throws UnknownDetectionTypeException
Fetches the DetectionType object for an identifier if it is present- Specified by:
getDetectionTypein interfaceIRegistry- Parameters:
identifier- String identifier for the detection type- Returns:
- the detection type object
- Throws:
UnknownDetectionTypeException- if the identifier is not registered
-
getDetectorAdjustableParameters
public java.util.List<AdjustableParameterObj> getDetectorAdjustableParameters(java.lang.Class<? extends IDetector> det)
Get the adjustable parameters for a detector- Specified by:
getDetectorAdjustableParametersin interfaceIRegistry- Parameters:
det- detector class- Returns:
- adjustable parameters for the detector class
-
getDetectorDescription
public java.lang.String getDetectorDescription(java.lang.Class<? extends IDetector> det)
Get the description of a detector- Specified by:
getDetectorDescriptionin interfaceIRegistry- Parameters:
det- detector class- Returns:
- description of the detector
-
getDetectorDisplayName
public java.lang.String getDetectorDisplayName(java.lang.Class<? extends IDetector> det)
Get the display name of the detector- Specified by:
getDetectorDisplayNamein interfaceIRegistry- Parameters:
det- detector class- Returns:
- display name of the detector
-
getDetectorLanguages
public java.util.Set<java.lang.String> getDetectorLanguages(java.lang.Class<? extends IDetector> det)
Get the languages supported by the detector- Specified by:
getDetectorLanguagesin interfaceIRegistry- Parameters:
det- detector class- Returns:
- languages supported by the detector
-
getDetectors
public java.util.Set<java.lang.Class<? extends IDetector>> getDetectors()
Fetch the set of all detectors registered to Sherlock- Specified by:
getDetectorsin interfaceIRegistry- Returns:
- a set of all detectors registered
-
getDetectors
public java.util.Set<java.lang.Class<? extends IDetector>> getDetectors(java.lang.String language)
Returns a set of all detectors registered which support the language specified- Specified by:
getDetectorsin interfaceIRegistry- Parameters:
language- the language string to search- Returns:
- the set of detectors
-
getLanguages
public java.util.Set<java.lang.String> getLanguages()
Returns the set of registered languages- Specified by:
getLanguagesin interfaceIRegistry- Returns:
- set of languages
-
getLexerForStrategy
public java.lang.Class<? extends org.antlr.v4.runtime.Lexer> getLexerForStrategy(PreProcessingStrategy strategy, java.lang.String language)
Finds and returns a valid lexer for the preprocessing stragety, if one cannot be found returns null- Specified by:
getLexerForStrategyin interfaceIRegistry- Parameters:
strategy- the PreProcessingStrategylanguage- the language string to prcess- Returns:
- valid lexer or null
-
getPostProcessorAdjustableParameters
public java.util.List<AdjustableParameterObj> getPostProcessorAdjustableParameters(java.lang.Class<? extends IPostProcessor> postProcessor)
Gets the adjustable parameters for a postprocessor- Specified by:
getPostProcessorAdjustableParametersin interfaceIRegistry- Parameters:
postProcessor- postprocessor class- Returns:
- the list of adjustable parameters
-
getPostProcessorAdjustableParametersFromDetector
public java.util.List<AdjustableParameterObj> getPostProcessorAdjustableParametersFromDetector(java.lang.Class<? extends IDetector> det)
Gets the adjustable parameters for the corresponding post processor for a detector- Specified by:
getPostProcessorAdjustableParametersFromDetectorin interfaceIRegistry- Parameters:
det- detector class- Returns:
- the list of adjustable parameters
-
getPostProcessorInstance
public IPostProcessor getPostProcessorInstance(java.lang.Class<? extends AbstractModelTaskRawResult> rawClass)
Get correct instance of IPostProcessor to process an AbstractModelTaskRawResult object- Specified by:
getPostProcessorInstancein interfaceIRegistry- Parameters:
rawClass- class- Returns:
- new instance of correct postprocessor
-
registerAdvancedPreProcessorGroup
public boolean registerAdvancedPreProcessorGroup(java.lang.Class<? extends IAdvancedPreProcessorGroup> preProcessorGroup)
Registers a grouping forIAdvancedPreProcessorto Sherlock. These groups of multiple Advanced PreProcessors all perform the same function, for different languages, laxers and parsers- Specified by:
registerAdvancedPreProcessorGroupin interfaceIRegistry- Parameters:
preProcessorGroup- the group- Returns:
- was successful?
-
registerAdvancedPreProcessorImplementation
public boolean registerAdvancedPreProcessorImplementation(java.lang.String groupClassPath, java.lang.Class<? extends IAdvancedPreProcessor> preProcessor)Registers anIAdvancedPreProcessorimplementation to a group- Specified by:
registerAdvancedPreProcessorImplementationin interfaceIRegistry- Parameters:
groupClassPath- the ClassPath for the group object to register to. The preProcessor MUST perform the groups assigned function, this cannot be checked!!!preProcessor- the implementation- Returns:
- was successful?
-
registerDetectionType
public boolean registerDetectionType(DetectionType detectionType)
Registers a detection type- Specified by:
registerDetectionTypein interfaceIRegistry- Parameters:
detectionType- object for the new detection type- Returns:
- was successful?
-
registerDetector
public boolean registerDetector(java.lang.Class<? extends IDetector> detector)
Registers anIDetectorimplementation to Sherlock. The presence of any dependencies should ideally tested before calling this method, one way to do this is to use theSherlockEngine.isModulePresent(String)- Specified by:
registerDetectorin interfaceIRegistry- Parameters:
detector- the implementation- Returns:
- was successful?
-
registerGeneralPreProcessor
public boolean registerGeneralPreProcessor(java.lang.Class<? extends IGeneralPreProcessor> preProcessor)
Registers anIGeneralPreProcessorimplementation to Sherlock- Specified by:
registerGeneralPreProcessorin interfaceIRegistry- Parameters:
preProcessor- the implementation- Returns:
- was successful?
-
registerLanguage
public boolean registerLanguage(java.lang.String name, java.lang.Class<? extends org.antlr.v4.runtime.Lexer> lexer)Register a lexer to the language of the name passed, creating the language if the name is not recognised- Specified by:
registerLanguagein interfaceIRegistry- Parameters:
name- Name of the language, not case sensitivelexer- Lexer implementation for the language- Returns:
- was successful?
-
registerPostProcessor
public final boolean registerPostProcessor(java.lang.Class<? extends IPostProcessor> postProcessor, java.lang.Class<? extends AbstractModelTaskRawResult> handledResultType)
Registers anIPostProcessorimplementation to Sherlock, associates it with theAbstractModelTaskRawResulttypes it will process- Specified by:
registerPostProcessorin interfaceIRegistry- Parameters:
postProcessor- the implementationhandledResultType- handledAbstractModelTaskRawResulttype(s) by the implementation- Returns:
- was successful?
-
-