Class SherlockRegistry
- java.lang.Object
-
- uk.ac.warwick.dcs.sherlock.api.registry.SherlockRegistry
-
public class SherlockRegistry extends java.lang.Object
Static access wrapper for the internal registry, should be used on initialisation to add components into the engine
-
-
Constructor Summary
Constructors Constructor Description SherlockRegistry()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static 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 combinationstatic DetectionType
getDetectionType(java.lang.String identifier)
Fetches the DetectionType object for an identifier if it is presentstatic java.util.List<AdjustableParameterObj>
getDetectorAdjustableParameters(java.lang.Class<? extends IDetector> det)
static java.lang.String
getDetectorDescription(java.lang.Class<? extends IDetector> det)
static java.lang.String
getDetectorDisplayName(java.lang.Class<? extends IDetector> det)
static java.util.Set<java.lang.String>
getDetectorLanguages(java.lang.Class<? extends IDetector> det)
static java.util.Set<java.lang.Class<? extends IDetector>>
getDetectors()
static java.util.Set<java.lang.Class<? extends IDetector>>
getDetectors(java.lang.String language)
Returns a set of all detectors registered which support the language specifiedstatic java.util.Set<java.lang.String>
getLanguages()
Returns the set of registered languagesstatic 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 nullstatic java.util.List<AdjustableParameterObj>
getPostProcessorAdjustableParameters(java.lang.Class<? extends IPostProcessor> postProcessor)
Gets the adjustable parameters for a postprocessorstatic java.util.List<AdjustableParameterObj>
getPostProcessorAdjustableParametersFromDetector(java.lang.Class<? extends IDetector> det)
Gets the adjustable parameters for the corresponding post processor for a detectorstatic IPostProcessor
getPostProcessorInstance(java.lang.Class<? extends AbstractModelTaskRawResult> rawClass)
Fetches the correctIPostProcessor
instance for the raw result typestatic boolean
registerAdvancedPreProcessorGroup(java.lang.Class<? extends IAdvancedPreProcessorGroup> preProcessorGroup)
Registers a grouping forIAdvancedPreProcessor
to Sherlock.static boolean
registerAdvancedPreProcessorImplementation(java.lang.String groupClassPath, java.lang.Class<? extends IAdvancedPreProcessor> preProcessor)
Registers anIAdvancedPreProcessor
implementation to a groupstatic boolean
registerDetectionType(DetectionType detectionType)
Registers a detection typestatic boolean
registerDetector(java.lang.Class<? extends IDetector> detector)
Registers anIDetector
implementation to Sherlockstatic boolean
registerGeneralPreProcessor(java.lang.Class<? extends IGeneralPreProcessor> preProcessor)
Registers anIGeneralPreProcessor
implementation to Sherlockstatic 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 recognisedstatic boolean
registerPostProcessor(java.lang.Class<? extends IPostProcessor> postProcessor, java.lang.Class<? extends AbstractModelTaskRawResult> handledResultTypes)
Associates anIPostProcessor
with a result type [AbstractModelTaskRawResult
]
-
-
-
Method Detail
-
getAdvancedPostProcessorForLanguage
public static 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- 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 static DetectionType getDetectionType(java.lang.String identifier) throws UnknownDetectionTypeException
Fetches the DetectionType object for an identifier if it is present- Parameters:
identifier
- String identifier for the detection type- Returns:
- the detection type object
- Throws:
UnknownDetectionTypeException
- if the identifier is not registered
-
getDetectorAdjustableParameters
public static java.util.List<AdjustableParameterObj> getDetectorAdjustableParameters(java.lang.Class<? extends IDetector> det)
- Parameters:
det
- detector class- Returns:
- adjustable parameters for the detector class
-
getDetectorDescription
public static java.lang.String getDetectorDescription(java.lang.Class<? extends IDetector> det)
- Parameters:
det
- detector class- Returns:
- description of the detector
-
getDetectorDisplayName
public static java.lang.String getDetectorDisplayName(java.lang.Class<? extends IDetector> det)
- Parameters:
det
- detector class- Returns:
- display name of the detector
-
getDetectorLanguages
public static java.util.Set<java.lang.String> getDetectorLanguages(java.lang.Class<? extends IDetector> det)
- Parameters:
det
- detector class- Returns:
- languages supported by the detector
-
getDetectors
public static java.util.Set<java.lang.Class<? extends IDetector>> getDetectors()
- Returns:
- a set of all detectors registered
-
getDetectors
public static 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- Parameters:
language
- the language to search- Returns:
- the set of detectors
-
getLanguages
public static java.util.Set<java.lang.String> getLanguages()
Returns the set of registered languages- Returns:
- set of languages
-
getLexerForStrategy
public static 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- Parameters:
strategy
- the PreProcessingStrategylanguage
- the language string to prcess- Returns:
- valid lexer or null
-
getPostProcessorAdjustableParameters
public static java.util.List<AdjustableParameterObj> getPostProcessorAdjustableParameters(java.lang.Class<? extends IPostProcessor> postProcessor)
Gets the adjustable parameters for a postprocessor- Parameters:
postProcessor
- postprocessor class- Returns:
- the list of adjustable parameters
-
getPostProcessorAdjustableParametersFromDetector
public static java.util.List<AdjustableParameterObj> getPostProcessorAdjustableParametersFromDetector(java.lang.Class<? extends IDetector> det)
Gets the adjustable parameters for the corresponding post processor for a detector- Parameters:
det
- detector class- Returns:
- the list of adjustable parameters
-
getPostProcessorInstance
public static IPostProcessor getPostProcessorInstance(java.lang.Class<? extends AbstractModelTaskRawResult> rawClass)
Fetches the correctIPostProcessor
instance for the raw result type- Parameters:
rawClass
- type to search- Returns:
- new instance of the correct postprocessor
-
registerAdvancedPreProcessorGroup
public static boolean registerAdvancedPreProcessorGroup(java.lang.Class<? extends IAdvancedPreProcessorGroup> preProcessorGroup)
Registers a grouping forIAdvancedPreProcessor
to Sherlock. These groups of multiple Advanced PreProcessors all perform the same function, for different languages, laxers and parsers- Parameters:
preProcessorGroup
- the group- Returns:
- was successful?
-
registerAdvancedPreProcessorImplementation
public static boolean registerAdvancedPreProcessorImplementation(java.lang.String groupClassPath, java.lang.Class<? extends IAdvancedPreProcessor> preProcessor)
Registers anIAdvancedPreProcessor
implementation to a group- 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 static boolean registerDetectionType(DetectionType detectionType)
Registers a detection type- Parameters:
detectionType
- object for the new detection type- Returns:
- was successful?
-
registerDetector
public static boolean registerDetector(java.lang.Class<? extends IDetector> detector)
Registers anIDetector
implementation to Sherlock- Parameters:
detector
- the implementation- Returns:
- was successful?
-
registerGeneralPreProcessor
public static boolean registerGeneralPreProcessor(java.lang.Class<? extends IGeneralPreProcessor> preProcessor)
Registers anIGeneralPreProcessor
implementation to Sherlock- Parameters:
preProcessor
- the implementation- Returns:
- was successful?
-
registerLanguage
public static 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- Parameters:
name
- Name of the language, not case sensitivelexer
- Lexer implementation for the language- Returns:
- was successful?
-
registerPostProcessor
public static boolean registerPostProcessor(java.lang.Class<? extends IPostProcessor> postProcessor, java.lang.Class<? extends AbstractModelTaskRawResult> handledResultTypes)
Associates anIPostProcessor
with a result type [AbstractModelTaskRawResult
]- Parameters:
postProcessor
- the PostProcessorhandledResultTypes
- the data type for the post processor- Returns:
- was sucessful?
-
-