Aufgrund einer Wartung wird GitLab am 25.01 zwischen 8:00 und 9:00 Uhr kurzzeitig nicht zur Verfügung stehen. / Due to maintenance, GitLab will be temporarily unavailable on 25.01 between 8:00 and 9:00 am.

Commit 258453cc authored by Christoph Richter's avatar Christoph Richter
Browse files

MathCommandRegister: Decreased cognitive complexity of isTargetLanguageCommand

parent 27152df8
......@@ -46,7 +46,17 @@ public abstract class MathCommand {
*
* @return targetLanguageCommandName
*/
public HashSet<String> getTargetLanguageCommandNames() {
protected HashSet<String> getTargetLanguageCommandNames() {
return targetLanguageCommandNames;
}
public boolean isTargetLanguageCommand(String command) {
if (!command.isEmpty())
for (String s : getTargetLanguageCommandNames())
if (s.contains(command))
return true;
return false;
}
}
......@@ -27,20 +27,17 @@ public abstract class MathCommandRegister {
public boolean isMathCommand(String functionName) {
boolean isMathCommand = false;
if (!functionName.isEmpty()) {
if (getMathCommand(functionName) != null) {
isMathCommand = true;
} else {
isMathCommand = isTargetLanguageCommand(functionName);
}
}
return isMathCommand;
}
private boolean isTargetLanguageCommand(String command) {
for (MathCommand mathCommand : mathCommands)
for (String s : mathCommand.getTargetLanguageCommandNames())
if (s.contains(command))
if (mathCommand.isTargetLanguageCommand(command))
return true;
return false;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment