Package org.mcp.core
Class MCPLabels
java.lang.Object
org.mcp.core.MCPLabels
- Direct Known Subclasses:
MCPFactory
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 Summary
FieldsModifier and TypeFieldDescriptionDomain name to variable type.Domain name to BDDFactory (for BDD dynamic domains).Domain name to set of EC indices.Domain name to set of static variables.Domain name to mapping from static variable to its EC indices.Domain name to mapping from object to static variable.Domain name to EC engine.Domain name to the "true" static variable. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a domain variable to this class.voidAdds a domain variable to the system.voidComputes the ECs for each domain and updates the relevant maps.getDomainChildrenNodes(String domainName) Gets the domain children nodes for a given domain.Retrieves the set of ECs for a given domain.getLabelECs(String domainName, Label var) Retrieves the set of ECs for a specific static variable within a given domain.Retrieves the set of ECs for a specific variable within a given domain.booleanChecks if one static variable contains another within a given domain.
-
Field Details
-
_domainNames
Domain name to variable type. -
_domainToECs
Domain name to set of EC indices. -
_domainToLabels
Domain name to set of static variables. -
_domainToLabelToECs
Domain name to mapping from static variable to its EC indices. -
_domainToStandardECs
Domain name to EC engine. -
_domainToBDDFactory
Domain name to BDDFactory (for BDD dynamic domains). -
_domainToTrueVariable
Domain name to the "true" static variable. -
_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
-
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
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
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
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
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
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
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
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.
-