I have a function that breaks up a source file and checks each token against a keyword list to determine whether its a particular file type. How can I improve this function? Tokenization
is a class that contains a function to break up the source code.
public static boolean validationTypeOfSQL(String sourceFile, Tokenization tokenization,ArrayList<String> uniqueKeywordList) {
ArrayList<Token> createSourceCodeTokens = tokenization.createSourceCodeTokens(sourceFile);
for (Token x : createSourceCodeTokens) {
String smallerTokens[] = tokenization.tokenToSmallerToken(x.getToken());
for (String smallerTOkenValue : smallerTokens) {
Boolean result = smallerTOkenValue.contains(",");
if (result == true) {
String[] tokenSplit = smallerTOkenValue.split(",");
for (String ts : tokenSplit) {
for (String t : uniqueKeywordList) {
if (t.toLowerCase().equals(ts.toLowerCase().replace("(", "").replace(",", "").replace(")", "").replace("\t", ""))) {
// System.out.println("This is a mysql file Mysql");
return true;
}
}
}
}
else {
for (String uniqueKeyword : uniqueKeywordList) {
if (uniqueKeyword.toLowerCase().equals(smallerTOkenValue.toLowerCase().replace("(", "").replace(",", "").replace(")", "")))
{
return true;
}
}
}
}
}
return false;
}