public class Main
extends java.lang.Object
Main class is used to interface with and run
the MetricalLpcfgGenerator class.| Modifier and Type | Field and Description |
|---|---|
static boolean |
EXTRACT |
static boolean |
LEXICALIZATION |
static boolean |
TESTING |
static boolean |
VERBOSE |
| Constructor and Description |
|---|
Main() |
| Modifier and Type | Method and Description |
|---|---|
private static void |
addToGrammar(MetricalLpcfg grammar,
MetricalLpcfgGenerator toAdd)
Add the grammar rules from the given generator to the given grammar.
|
private static void |
argumentError(java.lang.String message)
An argument error occurred.
|
private static void |
extractFromGrammar(MetricalLpcfg grammar,
MetricalLpcfgGenerator toExtract)
Extract the grammar rules from the given generator from the given grammar.
|
private static MetricalLpcfgGenerator |
generateGrammar(java.util.List<java.io.File> midiFiles,
java.util.List<java.io.File> anacrusisFiles,
boolean useChannel)
Generate a grammar from the given files with the given Runner.
|
static java.util.List<java.io.File> |
getAllFilesRecursive(java.io.File file)
Get and return a List of every file beneath the given one.
|
private static int |
getAnacrusisLength(java.io.File testFile,
java.util.List<java.io.File> anacrusisFiles)
Get the anacrusis length for the given test file given the anacrusis files.
|
static void |
main(java.lang.String[] args) |
private static void |
testGrammar(java.io.File testFile,
java.util.List<java.io.File> anacrusisFiles,
boolean useChannel,
MetricalLpcfg grammar,
MetricalLpcfgGenerator correctGrammarGenerator)
Test the given Runner with the given generated grammar.
|
public static boolean VERBOSE
public static boolean TESTING
public static boolean LEXICALIZATION
public static boolean EXTRACT
public static void main(java.lang.String[] args)
throws java.io.IOException,
java.lang.ClassNotFoundException
java.io.IOExceptionjava.lang.ClassNotFoundExceptionprivate static void testGrammar(java.io.File testFile,
java.util.List<java.io.File> anacrusisFiles,
boolean useChannel,
MetricalLpcfg grammar,
MetricalLpcfgGenerator correctGrammarGenerator)
throws MetricalLpcfgElementNotFoundException
testFile - The MIDI File we will use to test the grammar.anacrusisFiles - The anacrusis files for this run.useChannel - True if to use channels as the gold standard voice in MIDI files.
False for tracks.grammar - The grammar.correctGrammarGenerator - The correct grammar generator from this song.MetricalLpcfgElementNotFoundException - A tree to be extracted was not found in the grammar.private static void extractFromGrammar(MetricalLpcfg grammar, MetricalLpcfgGenerator toExtract) throws MetricalLpcfgElementNotFoundException
grammar - The grammar we want to extract the given rules from.toExtract - The generator which contains the rules we want to extract.MetricalLpcfgElementNotFoundException - A tree to be extracted was not found.private static void addToGrammar(MetricalLpcfg grammar, MetricalLpcfgGenerator toAdd)
grammar - The grammar we want to add the given rules to.toAdd - The generator which contains the rules we want to add.private static MetricalLpcfgGenerator generateGrammar(java.util.List<java.io.File> midiFiles, java.util.List<java.io.File> anacrusisFiles, boolean useChannel)
midiFiles - The Files we want to generate a grammar from.anacrusisFiles - The anacrusis files for the given midiFiles.useChannel - True if to use channels as the gold standard voice in MIDI files.
False for tracks.private static int getAnacrusisLength(java.io.File testFile,
java.util.List<java.io.File> anacrusisFiles)
testFile - The file for which we want the anacrusis.anacrusisFiles - The anacrusisFiles.public static java.util.List<java.io.File> getAllFilesRecursive(java.io.File file)
file - The head File.private static void argumentError(java.lang.String message)
NOTE: This method calls System.exit(1) and WILL NOT return.
message - The error message to print at the beginning of the exception.