Class DescribePattern

Object
com.owenfeehan.pathpatternfinder.describer.DescribePattern

public class DescribePattern
extends Object
Describes a pattern by generating a user-readable string representation of a pattern.
Author:
Owen Feehan
  • Method Details

    • apply

      public static String apply​(Pattern pattern, boolean includeVariableDescription)
      Generates a user-readable string describing a pattern.

      A string is always returned showing constant-value elements as text, and replacing variable-value elements with a string like ${3} where the number is an index.

      Parameters:
      pattern - the pattern to describe
      includeVariableDescription - whether to append additional lines describing each variable-value element, one for each element
      Returns:
      a user-readable string
    • apply

      public static String apply​(Pattern pattern, boolean includeVariableDescription, String prefixForVariablesLine, int maxLineWidth)
      Like apply(Pattern, boolean) but with additional parameterization.
      Parameters:
      pattern - the pattern to describe
      includeVariableDescription - whether to append additional lines describing each variable-value element, one for each element
      prefixForVariablesLine - a prefix prepended to each line that describes a variable (e.g. useful for implementing bullet points)
      maxLineWidth - maximum number of characters in a line
      Returns:
      a user-readable string