java.lang.Object
java.lang.Enum<MlfHelper>
org.vanted.plugins.layout.multilevelframework.MlfHelper
All Implemented Interfaces:
Serializable, Comparable<MlfHelper>, java.lang.constant.Constable

public enum MlfHelper
extends Enum<MlfHelper>
Helper methods for the multilevel framework add-on.
  • Method Details

    • values

      public static MlfHelper[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static MlfHelper valueOf​(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • calculateConnectedComponentsOfSelection

      public static List<? extends CoarsenedGraph> calculateConnectedComponentsOfSelection​(Set<Node> selection)
      Calculate the subgraph induced by the selection and split it up into its connected components. Note that this method is heavily inspired by GraphHelper.getConnectedComponentsAsCopy(List), which cannot be used directly by the MLF because it doesn't calculate the induced subgraph.
      Parameters:
      selection - The Selection. Must not be null.
      Returns:
      The connected components of the subgraph in induced by the selection, as CoarsenedGraphs.
    • validateNumber

      public static void validateNumber​(double number, double minValue, double maxValue, String name)
      Check whether a number is finite and in range. Display an error message if it is not.
      Parameters:
      number - The number to check.
      minValue - The (exclusive) minimum value.
      maxValue - The (exclusive) maximum value.
      name - The name of the corresponding parameter.
    • tryMakingNewInstance

      public static <T> T tryMakingNewInstance​(T t)
      Create new instances of the layouters to avoid interfering with the ones that VANTED holds. This is useful, for example if the MLF runs on multiple graphs at the same time but the algorithms/mergers/placers it uses aren't thread safe. If a new instance cannot be created, there's nothing that can be done except reusing the old one.
      Type Parameters:
      T - The class of the object to duplicate.
      Parameters:
      t - The object to duplicate.
      Returns:
      The duplicated object, or the old one if Class.newInstance() throws an exception.