Class GRDImpl
- All Implemented Interfaces:
GraphOfFORuleDependencies, Serializable, Cloneable, org.jgrapht.Graph<FORule,GRDEdge>
public class GRDImpl
extends org.jgrapht.graph.DirectedPseudograph<FORule,GRDEdge>
implements GraphOfFORuleDependencies
GRD implementation using unification
Rules of this GRD can have negation as long as the negation is safe
- See Also:
-
Field Summary
Fields inherited from interface org.jgrapht.Graph
DEFAULT_EDGE_WEIGHT -
Constructor Summary
ConstructorsConstructorDescriptionConstructor initialized with the rules from the rulebase no compilation and a productivity checkerGRDImpl(RuleBase ruleBase, RuleCompilation compilation) Constructor initialized with the rules from the rulebase and a productivity checkerGRDImpl(RuleBase rulebase, RuleCompilation compilation, Collection<DependencyChecker> checkers) Constructor initialized with the rules from the rulebaseGRDImpl(RuleBase ruleBase, Collection<DependencyChecker> checkers) Constructor initialized with the rules from the rulebase and no compilation -
Method Summary
Modifier and TypeMethodDescriptiongetAncestorRules(FORule target) Returns all rules that can trigger the specified one.Collection<? extends FORule> getAncestorRules(FORule target, Set<FORule> rulesToIgnore) Retrieves the ancestor rules by ignoring some rulesThe computed order of the stratification must guaranty a correct rule application but no additional assumption is done at this level on the computed stratumgetCompressedAncestorRules(FORule target) Returns the compressed ancestor rules of the specified rule.doubleThe computed order of the stratification must guaranty a correct rule application.getPreventedRules(FORule src) Returns all rules that can be prevented by the specified one.getRules()Return all the rules in the GRDComputes a stratification of the rules for single evaluation.getTriggeredRules(FORule src) Returns all rules that can be triggered by the specified one.booleanCheck if this GRD is stratifiableMethods inherited from class org.jgrapht.graph.DirectedPseudograph
createBuilder, createBuilderMethods inherited from class org.jgrapht.graph.AbstractBaseGraph
addEdge, addEdge, addVertex, addVertex, clone, containsEdge, containsVertex, degreeOf, edgeSet, edgesOf, getAllEdges, getEdge, getEdgeSource, getEdgeSupplier, getEdgeTarget, getType, getVertexSupplier, incomingEdgesOf, inDegreeOf, iterables, outDegreeOf, outgoingEdgesOf, removeEdge, removeEdge, removeVertex, setEdgeSupplier, setEdgeWeight, setVertexSupplier, vertexSetMethods inherited from class org.jgrapht.graph.AbstractGraph
assertVertexExist, containsEdge, equals, hashCode, removeAllEdges, removeAllEdges, removeAllEdges, removeAllVertices, toString, toStringFromSetsMethods inherited from interface org.jgrapht.Graph
containsEdge, removeAllEdges, removeAllEdges, removeAllVertices, setEdgeWeight
-
Constructor Details
-
GRDImpl
public GRDImpl(RuleBase rulebase, RuleCompilation compilation, Collection<DependencyChecker> checkers) Constructor initialized with the rules from the rulebase- Parameters:
rulebase- the ruleset to compute dependencies overcompilation- compilation used on the rulesetcheckers- checkers of the dependencies
-
GRDImpl
Constructor initialized with the rules from the rulebase no compilation and a productivity checker- Parameters:
ruleBase- the ruleset to compute dependencies over
-
GRDImpl
Constructor initialized with the rules from the rulebase and a productivity checker- Parameters:
ruleBase- the ruleset to compute dependencies overcompilation- compilation used on the ruleset
-
GRDImpl
Constructor initialized with the rules from the rulebase and no compilation- Parameters:
ruleBase- the ruleset to compute dependencies overcheckers- checkers of the dependencies
-
-
Method Details
-
getRules
Description copied from interface:GraphOfFORuleDependenciesReturn all the rules in the GRD- Specified by:
getRulesin interfaceGraphOfFORuleDependencies- Returns:
- all the rules in the GRD
-
getTriggeredRules
Description copied from interface:GraphOfFORuleDependenciesReturns all rules that can be triggered by the specified one.- Specified by:
getTriggeredRulesin interfaceGraphOfFORuleDependencies- Parameters:
src- a Rule.- Returns:
- all rules that can be triggered by the specified one.
-
getAncestorRules
Description copied from interface:GraphOfFORuleDependenciesReturns all rules that can trigger the specified one.- Specified by:
getAncestorRulesin interfaceGraphOfFORuleDependencies- Parameters:
target- a Rule.- Returns:
- all rules that can trigger the specified one.
-
getAncestorRules
Description copied from interface:GraphOfFORuleDependenciesRetrieves the ancestor rules by ignoring some rules- Specified by:
getAncestorRulesin interfaceGraphOfFORuleDependencies- Parameters:
target- the rule whose ancestors are requestedrulesToIgnore- these rules will be ignored in the recursive search of ancestors- Returns:
- the ancestor rules found while ignoring the supplied rules
-
getCompressedAncestorRules
Description copied from interface:GraphOfFORuleDependenciesReturns the compressed ancestor rules of the specified rule.- Specified by:
getCompressedAncestorRulesin interfaceGraphOfFORuleDependencies- Parameters:
target- the rule whose compressed ancestors are requested- Returns:
- the compressed ancestor rules of the specified rule
-
getPreventedRules
Description copied from interface:GraphOfFORuleDependenciesReturns all rules that can be prevented by the specified one.- Specified by:
getPreventedRulesin interfaceGraphOfFORuleDependencies- Parameters:
src- a Rule.- Returns:
- all rules that can be prevented by the specified one.
-
isStratifiable
public boolean isStratifiable()Description copied from interface:GraphOfFORuleDependenciesCheck if this GRD is stratifiable- Specified by:
isStratifiablein interfaceGraphOfFORuleDependencies- Returns:
- true iff the ruleset represented by this GRD is stratifiable
-
getBySccStratification
Description copied from interface:GraphOfFORuleDependenciesThe computed order of the stratification must guaranty a correct rule application but no additional assumption is done at this level on the computed stratum- Specified by:
getBySccStratificationin interfaceGraphOfFORuleDependencies- Returns:
- the stratification as an ordered list of rulebases
-
getSingleEvaluationStratification
Description copied from interface:GraphOfFORuleDependenciesComputes a stratification of the rules for single evaluation. This method ensures that each rule is evaluated exactly once and attempts to minimize the number of strata. This is only possible for an acyclic graph; if the graph contains a cycle, an empty Optional is returned.- Specified by:
getSingleEvaluationStratificationin interfaceGraphOfFORuleDependencies- Returns:
- an Optional containing the stratification as an ordered list of rule bases if the graph is acyclic, otherwise an empty Optional.
-
getMinimalStratification
Description copied from interface:GraphOfFORuleDependenciesThe computed order of the stratification must guaranty a correct rule application. This method should try to minimize the number of stratum while keeping a correct order but no guaranty is given on the minimality of the result. An empty optional should be returned if the rules are not stratifiable- Specified by:
getMinimalStratificationin interfaceGraphOfFORuleDependencies- Returns:
- the stratification as an ordered list of rulebases
-
getEdgeWeight
-