Package net.oijon.osca
Class Category
- java.lang.Object
-
- net.oijon.osca.Category
-
public class Category extends java.lang.ObjectCreates an object that contains a list of strings, and a name that can be used inside strings as placeholders.
-
-
Field Summary
Fields Modifier and Type Field Description static CategoryWHITESPACE
-
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 categoriesjava.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 categoryjava.util.ArrayList<java.lang.String>replaceFirstInstance(java.lang.String input)Replaces the first instance of a category with every possible valuejava.util.ArrayList<java.lang.String>replaceInstance(java.lang.String input, int instance)java.lang.StringreplaceInstance(java.lang.String input, int instance, int indexInCat)Replace a given instance of a category with a given category index
-
-
-
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 categoryvalues- 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 categoryvalues- 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 stringinput- 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 useinstance- The instance of the category in the input to replaceindexInCat- 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)
-
-