java.lang.Object
com.github.curiousoddman.rgxgen.util.Util

public final class Util extends Object
  • Constructor Details

    • Util

      public Util()
  • Method Details

    • repeatChar

      public static String repeatChar(char c, int times)
      Repeats text multiple times
      Parameters:
      c - character to repeat
      times - number of times. Values less or equal to zero will result in empty string
      Returns:
      text repeated multiple times
    • randomlyChangeCase

      public static String randomlyChangeCase(Random rnd, String input)
      Randomly change case for the letters in a string
      Parameters:
      rnd - random to be used
      input - input string to randomize
      Returns:
      string with random characters changed case.
    • countCaseInsensitiveVariations

      public static BigInteger countCaseInsensitiveVariations(String value)
      Count number of variation of words in case insensitive manner. For example for word "a" - there are 2 variation ("a" and "A"). For word "1a" - there are also 2 variations ("1a" and "1A") For word "AB" - there are 4 variations: ("ab", "aB", "Ab", "BB")
      Parameters:
      value - word to calculate variations
      Returns:
      number of variations.
    • indexOfNextCaseSensitiveCharacter

      public static OptionalInt indexOfNextCaseSensitiveCharacter(CharSequence text, int startIndex)
      Finds next case sensitive character. Case sensitive character is either lower-case or upper-case character.
      Parameters:
      text - text to be analyzed
      startIndex - start search from index.
      Returns:
      index of next case sensitive character or empty if no such character present
    • makeVariations

      public static Set<String> makeVariations(List<String> originalTexts, char characterToReplace, char... allowedReplacements)
      Method creates variation by replacing characterToReplace with all allowedReplacements (one at a time)
      Parameters:
      originalTexts - texts from which variation are to be made
      characterToReplace - make variations by replacing this character in originalText
      allowedReplacements - replace characterToReplace with each of these characters
      Returns:
      all unique variations
    • invertSymbolsAndRanges

      public static void invertSymbolsAndRanges(List<SymbolRange> symbolRanges, CharList symbols, SymbolRange allCharactersRange, List<SymbolRange> invertedRanges, CharList invertedCharacters)
      In terms of sets = invertedRanges and invertedCharacters = allCharacterRange - symbols and symbolRanges i.e. in invertedRanges and invertedCharacters are all characters that are not in symbols and symbolRanges
      Parameters:
      symbolRanges -
      symbols -
      allCharactersRange -
      invertedRanges -
      invertedCharacters -
    • compactOverlappingRangesAndSymbols

      public static void compactOverlappingRangesAndSymbols(List<SymbolRange> originalSymbolRanges, CharList originalSymbols, List<SymbolRange> compactedRanges, CharList compactedSymbols)
    • isRightCanContinueLeft

      public static boolean isRightCanContinueLeft(SymbolRange left, SymbolRange right)
    • isRightWithinLeft

      public static boolean isRightWithinLeft(SymbolRange left, SymbolRange right)