Class MCPPolicy

java.lang.Object
org.iam.policy.grammer.Policy
org.iam.policy.model.MCPPolicy
All Implemented Interfaces:
MCPVar

public class MCPPolicy extends Policy implements MCPVar
MCPPolicy extends Policy and implements MCPVar for symbolic encoding.

Represents a policy as a symbolic MCPBitVector, supporting allow/deny statements, symbolic initialization, and computation of the policy's symbolic node.

Since:
2025-02-28
Author:
  • Constructor Details

    • MCPPolicy

      public MCPPolicy(Policy policy)
      Constructs an MCPPolicy from a Policy object. Separates allow and deny statements, sets up symbolic factories, and computes the symbolic node.
      Parameters:
      policy - the Policy to convert
      Throws:
      AssertionError - if the MCPFactory has not been set
  • Method Details

    • setMCPFactory

      public static void setMCPFactory(org.mcp.core.MCPFactory mcpFactory)
      Sets the MCPFactory for all MCPPolicy instances.
      Parameters:
      mcpFactory - the MCPFactory to use
    • getMCPFactory

      public static org.mcp.core.MCPFactory getMCPFactory()
      Returns the MCPFactory used by all MCPPolicy instances.
      Returns:
      the MCPFactory
    • getMCPNode

      public org.mcp.core.MCPBitVector getMCPNode()
      Returns the symbolic encoding node for this policy.
      Returns:
      the MCPBitVector node
    • initialMCPFactory

      public void initialMCPFactory()
      Initializes the MCPFactory with domain variables from allow and deny statements.
      Specified by:
      initialMCPFactory in interface MCPVar
    • getMCPNodeCalculation

      public org.mcp.core.MCPBitVector getMCPNodeCalculation()
      Computes and returns the symbolic encoding node for this policy. The result is the union of allow statements minus the union of deny statements.
      Specified by:
      getMCPNodeCalculation in interface MCPVar
      Returns:
      the MCPBitVector node for this policy
      Throws:
      AssertionError - if the MCPFactory has not been set
    • toString

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