Implementing Operations in VariaMos
From VariaMos Wiki
How to implement an operation in VariaMos (Deprecate)
- Operations are partially supported from the Operations Meta-Model
The following text is a the mockup of a guide to implement any operation in the VariaMos' environment:
- The operation's package is created depending on the operations' type.
- The class containing the operation to implement is created.
- Into that class will be placed the operation as a method, either as parameters of the method or as class members, the operation should have at least three incomes:
- One instance of the class SolverEditorType. This method should specify the implementation of the solver to be used (SWI-Prolog, GNU-Prolog or another one).
- One instance of the abstract class Solver. The actual subclass instantiated by the object (SWIPrologSolver, GNUPrologSolver or another one) will depend on the object of the type SolverEditorType referred above.
- One instance of the class HlclProgram, where the product line is specified.
- The operation could receive also configurations (Configuration class), configuration options (ConfigurationOptions class) and other data as incomes.
- Inside the implemented operation, the received model (as an HlclProgram object) is assigned to the Solver's class instance.
- Then the method solve() of the Solver instance is called, where the configuration and the configuration options received earlier are used as incoming parameters.
- After calling the method solve() the corresponding operation implemented into the Solver class is called (the one that interacts with the proprietary Prolog library). Some of them are already implemented (like getSolutions()), but it could be necessary to implement a new one. At this point, the Query class of the jpl package is intensively used, but there isn't any source code attached. At this level, reading the library's documentation is needed.
- Once the operation is implemented, the unit tests should be implemented too. They can be coded into the space test (placed below the src one in the project workspace), following a similar structure as the functional code (package/class/methods) and some naming convention.