Aufgabe 3 gelöst.
This commit is contained in:
parent
09f62550d3
commit
49a8836144
|
@ -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){
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue