Enum 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.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Method Summary
Modifier and Type Method Description static List<? extends CoarsenedGraph>
calculateConnectedComponentsOfSelection(Set<Node> selection)
Calculate the subgraph induced by the selection and split it up into its connected components.static <T> T
tryMakingNewInstance(T t)
Create new instances of the layouters to avoid interfering with the ones that VANTED holds.static void
validateNumber(double number, double minValue, double maxValue, String name)
Check whether a number is finite and in range.static MlfHelper
valueOf(String name)
Returns the enum constant of this type with the specified name.static MlfHelper[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.Methods inherited from class java.lang.Enum
compareTo, describeConstable, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
-
Method Details
-
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
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 nameNullPointerException
- 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 isheavily inspired byGraphHelper.getConnectedComponentsAsCopy(List)
, which cannot be used directly by the MLF because it doesn't calculate the induced subgraph.- Parameters:
selection
- TheSelection
. Must not benull
.- Returns:
- The connected components of the subgraph in induced by the selection, as
CoarsenedGraph
s.
-
validateNumber
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.
-