Class MCPCondition

java.lang.Object
org.iam.policy.grammer.Condition
org.iam.policy.model.MCPCondition
All Implemented Interfaces:
MCPVar

public class MCPCondition extends Condition implements 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:
  • Constructor Details

    • MCPCondition

      public MCPCondition(Condition other)
      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:
      initialMCPFactory in interface MCPVar
    • processPrefix

      public static String processPrefix(String prefix)
      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:
      getMCPNodeCalculation in interface MCPVar
      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

      public static String ignoreCase(String str)
      Converts a string to a case-insensitive regex pattern.
      Parameters:
      str - the input string
      Returns:
      a regex string for case-insensitive matching
    • toString

      public String toString()
      Returns a string representation of this MCPCondition.
      Overrides:
      toString in class Object
      Returns:
      a string representation