Class CodeFormatAvailableCharHelper

java.lang.Object
com.broadleafcommerce.promotion.offer.service.helper.CodeFormatAvailableCharHelper

public class CodeFormatAvailableCharHelper extends Object
Determines for a given character what the available replacement characters are.
Author:
bpolster
  • Field Details

  • Constructor Details

    • CodeFormatAvailableCharHelper

      public CodeFormatAvailableCharHelper()
  • Method Details

    • getAvailableCharactersForFormatElement

      public String getAvailableCharactersForFormatElement(CodeGenerator generator, char formatElement)
    • countCombinationsForGenerator

      public long countCombinationsForGenerator(CodeGenerator generator)
      Calculate the number of combinations for the passed in generator object.
      Parameters:
      generator - - instance of CodeGenerator to evaluate
      Returns:
      The number of unique codes that can be generated with this generator
    • countCombinationsForGenerator

      public long countCombinationsForGenerator(CodeGenerator generator, int skipCount, boolean firstOnly)
      Calculate the number of combinations for the passed in generator object.
      Parameters:
      generator - - instance of CodeGenerator to evaluate
      skipCount - - the number of characters in the code reserved as a bucket prefix
      firstOnly - - stop counting after the first variable position
      Returns:
      The number of unique codes that can be generated with this generator
    • resolveCharMap

      protected Map<Character,String> resolveCharMap(CodeGenerator generator)
      If the generator has a custom alphabet then use that for the charMap, otherwise, use the default charMap configured in the helper.
      Parameters:
      generator - The CodeGenerator
      Returns:
      The character map to use for the alphabet
    • countAllowedCharsInFirstPosition

      public long countAllowedCharsInFirstPosition(CodeGenerator generator)