Package com.solibri.smc.api.checking
Class ConcurrentRule
- java.lang.Object
-
- com.solibri.smc.api.checking.ConcurrentRule
-
- All Implemented Interfaces:
CheckingNode
,Rule
public abstract class ConcurrentRule extends Object implements Rule
Extend this abstract class to implement a rule in which components passing a main filter are concurrently using a thread pool. Implementing a rule extending this requires that every common variable is handled in a thread-safe way, otherwise the rule might exhibit undeterministic behaviour.- Since:
- 9.10.6
-
-
Constructor Summary
Constructors Constructor Description ConcurrentRule()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
check(CheckingSelection components, ResultFactory resultFactory)
Called to implement the check phase.abstract Collection<Result>
check(Component component, ResultFactory resultFactory)
Called once for each component to be checked.ComponentFilter
getDefaultFilter()
Returns the default filter for this rule.FilterParameter
getDefaultFilterParameter()
Returns the default filter parameter for this rule.PreCheckResult
preCheck()
This is called once before the checking of components.PreCheckResult
preCheck(ComponentSelector components)
This method is called once before the actual checking of the components.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.solibri.smc.api.checking.Rule
getChildren, getName, getParametersUIDefinition, getParent, postCheck
-
-
-
-
Method Detail
-
getDefaultFilterParameter
public final FilterParameter getDefaultFilterParameter()
Returns the default filter parameter for this rule.- Returns:
- the default filter parameter for this rule
- Since:
- 9.10.6
-
getDefaultFilter
public final ComponentFilter getDefaultFilter()
Returns the default filter for this rule.- Returns:
- the default filter for this rule
- Since:
- 9.10.6
-
preCheck
public PreCheckResult preCheck()
This is called once before the checking of components. Use cases: - pre-calculation for checking - pre-condition check A pre-check result must be able to answer two questions: 1) Is proceeding beyond pre-check to check and post-check relevant with the state of the rule and the model? 2) What comment does it have on its result if the result is irrelevant i.e. checking should not proceed beyond pre-check? (e.g. a comment explaining that checking further is irrelevant because rule parameters are malformed or model does not contain any relevant component) If the default filter does not produce any component to check, the result will always be irrelevant because of absence of components, even if a relevant result would otherwise be produced.- Returns:
- a pre-check result
- Since:
- 9.10.6
-
preCheck
public final PreCheckResult preCheck(ComponentSelector components)
Description copied from interface:Rule
This method is called once before the actual checking of the components. The job of the pre check method is to select the components to be checked through theComponentSelector
parameter. Additionally, aPreCheckResult
must be returned, reporting if the checking of this rule should continue to the next phase (withPreCheckResult.createRelevant()
) or skipped (withPreCheckResult.createIrrelevant()
). In both cases, a message can be added to document the result.- Specified by:
preCheck
in interfaceRule
- Parameters:
components
- theCheckingSelection
to mark components as checked- Returns:
- a pre-check result
-
check
public final void check(CheckingSelection components, ResultFactory resultFactory)
Description copied from interface:Rule
Called to implement the check phase. All the components selected during the pre check phase must be reported as checked through theCheckingSelection
instance received as parameter, during the check phase.- Specified by:
check
in interfaceRule
- Parameters:
components
- theCheckingSelection
to mark components as checkedresultFactory
- the result factory used to create results for this rule
-
check
public abstract Collection<Result> check(Component component, ResultFactory resultFactory)
Called once for each component to be checked.- Parameters:
component
- the component to checkresultFactory
- the result factory used to create results for this rule- Returns:
- a collection of the results for the component currently checked
- Since:
- 9.10.6
-
-