Package org.iam.policy.model
Class MCPCondition
java.lang.Object
org.iam.policy.grammer.Condition
org.iam.policy.model.MCPCondition
- All Implemented Interfaces:
MCPVar
MCPCondition extends Condition and implements MCPVar for symbolic encoding.
Represents a condition that can be encoded as an MCPBitVector for symbolic reasoning. Provides methods to initialize the symbolic factory, compute the symbolic node, and handle various string and prefix operators.
- Since:
- 2025-02-28
- Author:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.iam.policy.grammer.Condition
Condition.VarOperator -
Field Summary
Fields inherited from class org.iam.policy.grammer.Condition
keyToValues, operator -
Constructor Summary
ConstructorsConstructorDescriptionMCPCondition(Condition other) Constructs an MCPCondition by copying from another Condition. -
Method Summary
Modifier and TypeMethodDescriptionstatic org.mcp.core.MCPFactoryReturns the MCPFactory used by all MCPCondition instances.org.mcp.core.MCPBitVectorReturns the symbolic encoding node for this condition.org.mcp.core.MCPBitVectorComputes and returns the symbolic encoding node for this condition.static StringignoreCase(String str) Converts a string to a case-insensitive regex pattern.voidInitializes the MCPFactory with domain variables based on this condition's key-value pairs.static StringprocessPrefix(String prefix) Processes a prefix string, appending "/32" if not already present.static voidsetMCPFactory(org.mcp.core.MCPFactory mcpFactory) Sets the MCPFactory for all MCPCondition instances.toString()Returns a string representation of this MCPCondition.Methods inherited from class org.iam.policy.grammer.Condition
equals, getKeyToValues, getOperator, hashCode, setKeyToValues, setOperator
-
Constructor Details
-
MCPCondition
Constructs an MCPCondition by copying from another Condition.- Parameters:
other- the Condition to copy
-
-
Method Details
-
setMCPFactory
public static void setMCPFactory(org.mcp.core.MCPFactory mcpFactory) Sets the MCPFactory for all MCPCondition instances.- Parameters:
mcpFactory- the MCPFactory to use
-
getMCPFactory
public static org.mcp.core.MCPFactory getMCPFactory()Returns the MCPFactory used by all MCPCondition instances.- Returns:
- the MCPFactory
-
initialMCPFactory
public void initialMCPFactory()Initializes the MCPFactory with domain variables based on this condition's key-value pairs. Adds each domain variable to the factory with the appropriate static variable type.- Specified by:
initialMCPFactoryin interfaceMCPVar
-
processPrefix
Processes a prefix string, appending "/32" if not already present.- Parameters:
prefix- the input prefix string- Returns:
- the processed prefix string
-
getMCPNodeCalculation
public org.mcp.core.MCPBitVector getMCPNodeCalculation()Computes and returns the symbolic encoding node for this condition. Returns the cached value if already computed.- Specified by:
getMCPNodeCalculationin interfaceMCPVar- Returns:
- the MCPBitVector node for this condition
-
getMCPNode
public org.mcp.core.MCPBitVector getMCPNode()Returns the symbolic encoding node for this condition.- Returns:
- the MCPBitVector node
-
ignoreCase
Converts a string to a case-insensitive regex pattern.- Parameters:
str- the input string- Returns:
- a regex string for case-insensitive matching
-
toString
Returns a string representation of this MCPCondition.
-