Interface description
Copy
The interface definition is:
public interface IConfiguratorServices
{
ReadOnlyScope GetScope(Item targetScopeItem);
IScopeSolver CreateSolver(ReadOnlyScope scope);
}
Where:
| ReadOnlyScope | Class representing a Scope object with list of rules and list of variables. It cannot be modified. |
| IScopeSolver | Interface that represents a scope solver. This interface is responsible for setting the scope and getting combinations. |
Both interface methods are described below.
GetScope
public ReadOnlyScope GetScope(Item targetScopeItem);
Method returns ReadOnlyScope with immutable list of rules and list of variables. ReadOnlyScope class defined as:
public class ReadOnlyScope
{
public string Id;
public string Name;
public ReadOnlyCollection<Rule> RuleList;
public ReadOnlyCollection<Variable> VariableList;
}
targetScopeItem parameter can be defined like (see 4.3.2)
Item targetScopeItem = this.newItem(“Method”, "%builder method name%");
targetScopeItem.setAttribute(
"%builder method attribute name %",
"%builder method attribute value %");
targetScopeItem.setProperty(
"%builder method property name%",
"%builder method property value%");
Where:
| %builder method name% | Name of the server method that builds the Scope object model based on the business logic being used. |
| %builder method attribute name% | Builder method attribute name. |
| %builder method attribute value% | Builder method attribute value. |
| %builder method property name% | Builder method property name. |
| %builder method property value% | Builder method property value. |
CreateSolver
public IScopeSolver CreateSolver(ReadOnlyScope scope);
IScopeSolver interface is declared as following:
public interface IScopeSolver
{
ReadOnlyScope Scope { get; }
ExpressionBase Condition { get; set; }
IEnumerable<IEnumerable<ExpressionTerm>>FindAllCombinations(
IList<Variable> selectVariables);
IEnumerable<IEnumerable<ExpressionTerm>> FindAllCombinations(
IList<Variable> selectVariables,
ExpressionBase additionalCondition);
}
FindAllCombinations
Method returns all possible valid combinations. Returned object is a collection of IEnumerable<ExpressionTerm> objects. A single IEnumerable<ExpressionTerm> is a unique combination of all variables and their values.
ExpressionTerm class consists of two fields:
- OperandLeft – represents a certain variable in combination.
- OperandRight – represents a value (named-constant) corresponding to the variable.
Both operands contain an Id and Value of a variable (for the OperandLeft) and of named-constant (for the OperandRight).