Implementing Operations in VariaMos

From VariaMos Wiki
Jump to: navigation, search

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:

  1. The operation's package is created depending on the operations' type.
  2. The class containing the operation to implement is created.
  3. 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:
    1. 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).
    2. 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.
    3. One instance of the class HlclProgram, where the product line is specified.
  4. The operation could receive also configurations (Configuration class), configuration options (ConfigurationOptions class) and other data as incomes.
  5. Inside the implemented operation, the received model (as an HlclProgram object) is assigned to the Solver's class instance.
  6. Then the method solve() of the Solver instance is called, where the configuration and the configuration options received earlier are used as incoming parameters.
  7. 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.
  8. 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.