Package org.mcp.core

Class MCPLabels

java.lang.Object
org.mcp.core.MCPLabels
Direct Known Subclasses:
MCPFactory

public class MCPLabels extends Object
The MCPLabels class represents a collection of equivalence classes (ECs) across multiple domains.

It manages different types of static variable domains and provides methods to calculate and query ECs, as well as to manage the mapping between domain names, variable types, and their ECs.

Since:
2025-02-28
  • Field Details

    • _domainNames

      protected HashMap<String,LabelType> _domainNames
      Domain name to variable type.
    • _domainToECs

      protected Map<String,Set<Integer>> _domainToECs
      Domain name to set of EC indices.
    • _domainToLabels

      protected Map<String,Set<Label>> _domainToLabels
      Domain name to set of static variables.
    • _domainToLabelToECs

      protected Map<String,Map<Label,Set<Integer>>> _domainToLabelToECs
      Domain name to mapping from static variable to its EC indices.
    • _domainToStandardECs

      protected Map<String,ECEngine> _domainToStandardECs
      Domain name to EC engine.
    • _domainToBDDFactory

      protected Map<String,net.sf.javabdd.BDDFactory> _domainToBDDFactory
      Domain name to BDDFactory (for BDD dynamic domains).
    • _domainToTrueVariable

      protected Map<String,Label> _domainToTrueVariable
      Domain name to the "true" static variable.
    • _domainToObjectToLabel

      protected Map<String,Map<Object,Label>> _domainToObjectToLabel
      Domain name to mapping from object to static variable.
  • Constructor Details

    • MCPLabels

      public MCPLabels()
      Constructs an MCPLabels object. Initializes all the internal maps and prepares the object for handling domain - related operations.
  • Method Details

    • getDomainNames

      public HashMap<String,LabelType> getDomainNames()
    • computeLabels

      public void computeLabels()
      Computes the ECs for each domain and updates the relevant maps. First, it creates true variables for each domain. Then, it adds all true variables to the domain's static variables. For each domain, it creates a standard atomic predicate object based on the static variables and the true variable of the domain, and stores the atomic predicate information in the corresponding maps.
    • addVar

      public void addVar(String domainName, LabelType type, Object value)
      Adds a domain variable to the system. If the mapping from domain name to object - static variable map does not exist, it initializes one. If the given object does not have a corresponding static variable in the domain, it creates one. Then, it adds the corresponding static variable to the domain.
      Parameters:
      domainName - The name of the domain to which the variable will be added.
      type - The type of the static variable.
      value - The value of the variable, which will be used to create the static variable.
    • addLabel

      public void addLabel(String domainName, LabelType type, Label label)
      Adds a domain variable to this class. If the domain does not exist, it adds the domain name and its type to the domain names map. If the domain is of PREFIX type, it initializes a BDDFactory for the domain. It also adds the static variable to the set of static variables for the domain.
      Parameters:
      domainName - The name of the domain.
      type - The type of the static variable in the domain.
      label - The static variable to be added.
    • getECs

      public Set<Integer> getECs(String domainName)
      Retrieves the set of ECs for a given domain.
      Parameters:
      domainName - The name of the domain.
      Returns:
      The set of ECs for the domain, or null if the domain does not exist.
    • getVarECs

      public Set<Integer> getVarECs(String domainName, Object var)
      Retrieves the set of ECs for a specific variable within a given domain. First, it gets the corresponding static variable from the object - static variable map. Then, it calls the method to get the ECs for the static variable.
      Parameters:
      domainName - The name of the domain.
      var - The variable for which the ECs are to be retrieved.
      Returns:
      The set of ECs for the variable in the domain, or null if the domain or variable does not exist.
    • getLabelECs

      public Set<Integer> getLabelECs(String domainName, Label var)
      Retrieves the set of ECs for a specific static variable within a given domain.
      Parameters:
      domainName - The name of the domain.
      var - The static variable.
      Returns:
      The set of ECs for the static variable in the domain, or null if the domain or variable does not exist.
    • getDomainChildrenNodes

      public HashMap<Object,HashSet<Object>> getDomainChildrenNodes(String domainName)
      Gets the domain children nodes for a given domain. It calculates the relationships between static variables in the domain based on the isContain method.
      Parameters:
      domainName - The name of the domain.
      Returns:
      A map where keys are static variables and values are sets of their child static variables.
    • isContain

      public boolean isContain(String domainName, Label var1, Label var2)
      Checks if one static variable contains another within a given domain. It determines the containment relationship based on whether the ECs of one variable contain all the ECs of the other.
      Parameters:
      domainName - The name of the domain.
      var1 - The first static variable.
      var2 - The second static variable.
      Returns:
      true if var1 contains var2, false otherwise.