Class SolutionView

java.lang.Object
org.clafer.ig.SolutionView

public final class SolutionView extends Object
The views of the solutions, claferIG's SolutionView.hs: a static model has instances, and a dynamic model has traces, whose states are instances. Both are sequences of snapshots, which the full view shows one by one, and the diff view shows as the changes from the previous snapshot.
  • Method Details

    • showSolution

      public static String showSolution(int n, Solution solution)
      The full view of the n-th solution: the instance, or each state of the trace.
    • solutionText

      public static String solutionText(Solution solution)
      The text of a solution, as it is saved: the instance, or the states of the trace.
    • showSolutionDiff

      public static String showSolutionDiff(UnaryOperator<String> names, int n, Solution previous, Solution solution)
      The diff view of the n-th solution. The first state of a trace, whose clafers all appear (+), is shown in full, and each next state as its changes: the clafers that appear (+), with their children, and that disappear (-), and the values that change (~), each at its depth in the tree and with its least-partially-qualified name, given by the UID of its clafer. The states are compared by instance, which has the same name in every state. An instance is compared with the previous instance, if any, by its structure, since the names of the instances of separate solutions are unrelated.
      Parameters:
      previous - the previous solution, or null
    • solutionDot

      public static String solutionDot(Solution solution)
      The Graphviz graph of a solution: an instance is a single node, and a trace is a node per state with an edge to the next state, and a dashed edge from the last state back to the loop state.
    • solutionDiffDot

      public static String solutionDiffDot(UnaryOperator<String> names, Solution solution)
      The Graphviz graph of a solution in the diff view, which keeps large traces readable: the first state in full, and each next state as its changes from the previous one.