class TopCollectionClassGenerator extends Object
| Modifier and Type | Field and Description |
|---|---|
private static String |
ARRAY_EQUALS_DELTA_OBEJCT_ARRAY_KEY
Defining the String which will be replaced with the delta which is needed
to compare double or float values of the associated array in the JUnit
tests (or an empty String if the type of the associated array is not
double or float).
|
private static String |
ARRAY_EQUALS_DELTA_VALUE_ARRAY_KEY
Defining the String which will be replaced with the delta which is needed
to compare double or float values of the sorted array in the JUnit tests
(or an empty String if the type of the sorted array is not double or
float).
|
private static String |
ASSOCIATED_TYPE_KEY
Defining the String which will be replaced with the type of the
associated array.
|
private static String[] |
ASSOCIATED_TYPES
Defining the types the associated array can have.
|
private static String |
CLASS_NAME_KEY |
private static String |
CLASS_NAME_PATTERN |
private static String |
CLASS_PATTERN_FILE |
private static String |
GENERIC_CLASS_PATTERN_FILE |
private static String |
GENERIC_TEST_CLASS_PATTERN_FILE |
private static String |
PATH_TO_COLLECTION_CLASS_FILE |
private static String |
PATH_TO_COLLECTION_TEST_CLASS_FILE |
private static String[] |
PRIMITIVE_SORT_TYPES
Defining the types the sorted array can have.
|
private static String |
RANDOM_OBJECT_CREATION_KEY |
private static String |
RANDOM_VALUE_CREATION_KEY |
private static String |
TEST_CLASS_PATTERN_FILE |
private static String |
VALUE_TYPE_KEY
Defining the String which will be replaced with the type of the sorted
array.
|
| Constructor and Description |
|---|
TopCollectionClassGenerator() |
| Modifier and Type | Method and Description |
|---|---|
private void |
createClassFile(String sortedType,
String associatedType,
String classDefintion)
This method creates the class file of a collection with the given value
and associated data types.
|
private void |
createGenericClassFile(String sortedType,
String genericClassString)
This method creates the class file of a collection with a generic object
type.
|
private void |
createGenericTestClassFile(String sortedType,
String genericTestClassString)
This method creates the test class for collections with a generic object
type.
|
private void |
createTestClassFile(String sortedType,
String associatedType,
String testClassDefinition)
This method creates the test class of a collection with the given value
and associated data types.
|
private String |
loadClassDefintion(String filename)
Loads the class definition from file.
|
static void |
main(String[] args)
Starts the generation.
|
private void |
writeTopCollectionClasses(String[] primitiveSortTypes,
String[] associatedTypes) |
private void |
writeTopCollectionClasses(String[] primitiveSortTypes,
String[] associatedTypes,
String classString,
String testClassString,
String genericClassString,
String genericTestClassString) |
private static final String CLASS_NAME_PATTERN
private static final String PATH_TO_COLLECTION_CLASS_FILE
private static final String PATH_TO_COLLECTION_TEST_CLASS_FILE
private static final String CLASS_NAME_KEY
private static final String VALUE_TYPE_KEY
private static final String ASSOCIATED_TYPE_KEY
private static final String RANDOM_VALUE_CREATION_KEY
private static final String RANDOM_OBJECT_CREATION_KEY
private static final String ARRAY_EQUALS_DELTA_VALUE_ARRAY_KEY
private static final String ARRAY_EQUALS_DELTA_OBEJCT_ARRAY_KEY
private static final String CLASS_PATTERN_FILE
private static final String TEST_CLASS_PATTERN_FILE
private static final String GENERIC_CLASS_PATTERN_FILE
private static final String GENERIC_TEST_CLASS_PATTERN_FILE
private static final String[] PRIMITIVE_SORT_TYPES
private static final String[] ASSOCIATED_TYPES
public static void main(String[] args)
args - private void writeTopCollectionClasses(String[] primitiveSortTypes, String[] associatedTypes)
private String loadClassDefintion(String filename)
filename - the filename containing the class definition.private void writeTopCollectionClasses(String[] primitiveSortTypes, String[] associatedTypes, String classString, String testClassString, String genericClassString, String genericTestClassString) throws IOException
IOExceptionprivate void createClassFile(String sortedType, String associatedType, String classDefintion) throws IOException
sortedType - The type of the elements which will be used for sorting.associatedType - The type of the associated elements.classDefintion - The definition of the class.IOExceptionprivate void createTestClassFile(String sortedType, String associatedType, String testClassDefinition) throws IOException
sortedType - The type of the elements which will be used for sorting.associatedType - The type of the associated elements.testClassDefinition - The definition of the test class.IOExceptionprivate void createGenericClassFile(String sortedType, String genericClassString) throws IOException
sortedType - The type of the elements which will be used for sorting.genericClassString - The definition of the class.IOExceptionprivate void createGenericTestClassFile(String sortedType, String genericTestClassString) throws IOException
sortedType - The type of the elements which will be used for sorting.genericTestClassString - The definition of the test class.IOExceptionCopyright © 2015–2020. All rights reserved.