Common¶
com.mbeddr.mpsutil.common
The common class don't have any dependencies and deal with very generic functionality.
Graph¶
The graph model contains classes for working with graphs and an implementation for the AVL tree data structure, a self-balancing binary search tree ⧉. You can use the Graph class together with GraphUtil ⧉, which provides the following methods:
- computeSCC(Graph): computes the strongly connected components of the given graph
- isConnected(Graph, T initial): determines whether the given directed graph corresponds to a connected graph
- computeSCCSingle(T sought, graph): returns the set of nodes in the strongly connected component ⧉ that the node to find is in
- computeTopologicalSorting(Graph, boolean silent): returns the topological sorting ⧉ of the nodes of the given graph.
Model¶
The class ConceptInstanceFinder ⧉ contains a few methods for finding instances (= nodes) of a concept:
-
findAllVisibleInstances(context, conceptToFind): find instances of a concept in the used languages of the model. The context node's model is the starting point.
-
findAllInstances(conceptToFind): searches for nodes of the given concept in all user models from the global scope (not including transient and temporary models)
Util¶
The class ApplicationHelper contains a method for running a Runnable object inside a progress window that optionally can be canceled. The class ModelComparator can compare two models programmatically and report the mismatches between them. SNodeIdentityWrapper ⧉ is used to preserve node identity across model boundaries and is helpful in generator scenarios where you copy nodes between the different phases.
Comparator¶
com.mbeddr.mpsutil.comparator
You can compare two nodes programmatically with the class MPSNodeComparator ⧉. Overloaded methods
for ignoring properties, ignored references, and some more settings exist. The returned object of class MPSNodeComparison ⧉ contains the list of differences and can also pre pretty printed by calling the method getDescription()
.