Aufgabe 3 gelöst.

This commit is contained in:
schrom01 2022-09-20 20:54:04 +02:00
parent 09f62550d3
commit 49a8836144
2 changed files with 15 additions and 2 deletions

View File

@ -9,9 +9,9 @@ public class BracketServer implements CommandExecutor {
return checkBrackets(command) ? "true" : "false"; return checkBrackets(command) ? "true" : "false";
} }
public boolean checkBrackets(String command) { public boolean checkBrackets (String arg) {
Stack stack = new ListStack(); Stack stack = new ListStack();
char[] chars = command.toCharArray(); char[] chars = arg.toCharArray();
for (char x: chars) { for (char x: chars) {
Character closingBracket = getClosingBracketForOpening(x); Character closingBracket = getClosingBracketForOpening(x);
if(closingBracket != null){ if(closingBracket != null){

View File

@ -0,0 +1,13 @@
package ch.zhaw.ads;
public class WellformedXmlServer implements CommandExecutor {
@Override
public String execute(String command) throws Exception {
return checkWellformed(command) ? "true" : "false";
}
public boolean checkWellformed(String arg) {
}
}