Class Cfg
java.lang.Object
software.amazon.smithy.rulesengine.logic.cfg.Cfg
A Control Flow Graph (CFG) representation of endpoint rule decision logic.
The CFG transforms the hierarchical decision tree structure into an optimized representation with node deduplication to prevent exponential growth.
The CFG consists of:
- A root node representing the entry point of the decision logic
- A DAG structure where condition nodes are shared when they have identical subtrees
-
Method Summary
Modifier and TypeMethodDescriptionboolean
static Cfg
from
(EndpointRuleSet ruleSet) Create a CFG from the given ruleset.int
Gets the number of unique conditions in the CFG.getConditionIndex
(Condition condition) Gets the index of a condition in the conditions array.Gets all unique conditions in the CFG, in the order they were discovered.getRoot()
Returns the root node of the control flow graph.Get the endpoint ruleset version of the CFG.int
hashCode()
iterator()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
from
Create a CFG from the given ruleset.- Parameters:
ruleSet
- Rules to convert to CFG.- Returns:
- the CFG result.
-
getVersion
Get the endpoint ruleset version of the CFG.- Returns:
- endpoint ruleset version.
-
getConditions
Gets all unique conditions in the CFG, in the order they were discovered.- Returns:
- array of conditions
-
getConditionIndex
Gets the index of a condition in the conditions array.- Parameters:
condition
- the condition to look up- Returns:
- the index, or null if not found
-
getConditionCount
public int getConditionCount()Gets the number of unique conditions in the CFG.- Returns:
- the condition count
-
getParameters
-
equals
-
hashCode
public int hashCode() -
getRoot
Returns the root node of the control flow graph.- Returns:
- the root node
-
iterator
-