Class Category


  • public class Category
    extends java.lang.Object
    Creates an object that contains a list of strings, and a name that can be used inside strings as placeholders.
    • Constructor Summary

      Constructors 
      Constructor Description
      Category​(java.lang.String name, java.lang.String[] values)
      Creates a category from an array of values
      Category​(java.lang.String name, java.util.ArrayList<java.lang.String> values)
      Creates a category from an ArrayList of values
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.ArrayList<java.lang.String> generateMatchesFromCategoryList​(java.util.ArrayList<Category> categories, java.lang.String input)
      Generates all possible strings that could match an input given a list of categories
      java.util.ArrayList<java.lang.String> generatePossibleMatches​(java.lang.String input)  
      java.util.ArrayList<java.lang.String> generatePossibleMatches​(java.util.ArrayList<java.lang.String> inputList)
      Generates possible matches from a string using the current category
      java.util.ArrayList<java.lang.String> replaceFirstInstance​(java.lang.String input)
      Replaces the first instance of a category with every possible value
      java.util.ArrayList<java.lang.String> replaceInstance​(java.lang.String input, int instance)  
      java.lang.String replaceInstance​(java.lang.String input, int instance, int indexInCat)
      Replace a given instance of a category with a given category index
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • WHITESPACE

        public static final Category WHITESPACE
    • Constructor Detail

      • Category

        public Category​(java.lang.String name,
                        java.util.ArrayList<java.lang.String> values)
        Creates a category from an ArrayList of values
        Parameters:
        name - The name of the category
        values - Every value in the category
      • Category

        public Category​(java.lang.String name,
                        java.lang.String[] values)
        Creates a category from an array of values
        Parameters:
        name - The name of the category
        values - Every value in the category
    • Method Detail

      • generateMatchesFromCategoryList

        public static java.util.ArrayList<java.lang.String> generateMatchesFromCategoryList​(java.util.ArrayList<Category> categories,
                                                                                            java.lang.String input)
        Generates all possible strings that could match an input given a list of categories
        Parameters:
        categories - The list of categories that could potentially be in the string
        input - The string to expand
        Returns:
        Every possible string matching the input
      • generatePossibleMatches

        public java.util.ArrayList<java.lang.String> generatePossibleMatches​(java.util.ArrayList<java.lang.String> inputList)
        Generates possible matches from a string using the current category
        Parameters:
        inputList - The inputs to be processed
        Returns:
        Expanded forms for the given category
      • replaceFirstInstance

        public java.util.ArrayList<java.lang.String> replaceFirstInstance​(java.lang.String input)
        Replaces the first instance of a category with every possible value
        Parameters:
        input - The string to be used to replace
        Returns:
        The input with the first instance of the category replaced by every possible value
      • replaceInstance

        public java.lang.String replaceInstance​(java.lang.String input,
                                                int instance,
                                                int indexInCat)
        Replace a given instance of a category with a given category index
        Parameters:
        input - The input to use
        instance - The instance of the category in the input to replace
        indexInCat - The index inside the category of the value the category should be replaced with
        Returns:
        An expanded version of the input using the given instance and index
      • replaceInstance

        public java.util.ArrayList<java.lang.String> replaceInstance​(java.lang.String input,
                                                                     int instance)
      • generatePossibleMatches

        public java.util.ArrayList<java.lang.String> generatePossibleMatches​(java.lang.String input)