Fixed more sonarqube findings

This commit is contained in:
2022-07-04 01:19:59 -04:00
parent b4817e8bb3
commit e9c8397b86
2 changed files with 15 additions and 42 deletions

View File

@@ -81,47 +81,20 @@ public class Porta{
char replacer; char replacer;
switch(keyLetter){ switch(keyLetter){
case 'A': case 'A', 'B' -> replacer = tableau[0].charAt(tableauColumn);
case 'B': case 'C', 'D' -> replacer = tableau[1].charAt(tableauColumn);
replacer = tableau[0].charAt(tableauColumn); break; case 'E', 'F' -> replacer = tableau[2].charAt(tableauColumn);
case 'C': case 'G', 'H' -> replacer = tableau[3].charAt(tableauColumn);
case 'D': case 'I', 'J' -> replacer = tableau[4].charAt(tableauColumn);
replacer = tableau[1].charAt(tableauColumn); break; case 'K', 'L' -> replacer = tableau[5].charAt(tableauColumn);
case 'E': case 'M', 'N' -> replacer = tableau[6].charAt(tableauColumn);
case 'F': case 'O', 'P' -> replacer = tableau[7].charAt(tableauColumn);
replacer = tableau[2].charAt(tableauColumn); break; case 'Q', 'R' -> replacer = tableau[8].charAt(tableauColumn);
case 'G': case 'S', 'T' -> replacer = tableau[9].charAt(tableauColumn);
case 'H': case 'U', 'V' -> replacer = tableau[10].charAt(tableauColumn);
replacer = tableau[3].charAt(tableauColumn); break; case 'W', 'X' -> replacer = tableau[11].charAt(tableauColumn);
case 'I': case 'Y', 'Z' -> replacer = tableau[12].charAt(tableauColumn);
case 'J': default -> replacer = letter;
replacer = tableau[4].charAt(tableauColumn); break;
case 'K':
case 'L':
replacer = tableau[5].charAt(tableauColumn); break;
case 'M':
case 'N':
replacer = tableau[6].charAt(tableauColumn); break;
case 'O':
case 'P':
replacer = tableau[7].charAt(tableauColumn); break;
case 'Q':
case 'R':
replacer = tableau[8].charAt(tableauColumn); break;
case 'S':
case 'T':
replacer = tableau[9].charAt(tableauColumn); break;
case 'U':
case 'V':
replacer = tableau[10].charAt(tableauColumn); break;
case 'W':
case 'X':
replacer = tableau[11].charAt(tableauColumn); break;
case 'Y':
case 'Z':
replacer = tableau[12].charAt(tableauColumn); break;
default:
replacer = letter;
} }
return replacer; return replacer;

View File

@@ -135,7 +135,7 @@ public class PolybiusSquare{
return cleanString; return cleanString;
} }
protected String getPreparedInputStringDecoding(){ protected String getPreparedInputStringDecoding(){
return inputString.replaceAll("[^0-9]", ""); return inputString.replaceAll("\\D", "");
} }
//Strips invalid characters from the keyword and creates the grid //Strips invalid characters from the keyword and creates the grid
protected void setKeyword(String keyword){ protected void setKeyword(String keyword){