Mercurial > hg > Members > shoshi > jungle > jungle-core
changeset 244:5d033ad129b2 Implementation_of_communication
add condition
author | tatsuki |
---|---|
date | Sun, 21 Feb 2016 18:28:01 +0900 |
parents | fe0d5ed68caf |
children | 725a0176a873 |
files | src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/commandline/commandline.java src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/commandline/main.java src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/xml/reader/ReadXmlHandler.java |
diffstat | 3 files changed, 27 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/commandline/commandline.java Thu Feb 18 14:08:01 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/commandline/commandline.java Sun Feb 21 18:28:01 2016 +0900 @@ -31,24 +31,29 @@ public class commandline { Jungle jungle = new DefaultJungle(null, "hoge", new DefaultTreeEditor(new DefaultTraverser())); - public void start() throws IOException { + public void start() throws IOException, InterruptedException { System.out.println("jungle 対話モード"); while (true) { - System.out.println("入力受付中"); + try { + System.out.println("入力受付中"); - InputStreamReader isr = new InputStreamReader(System.in); - BufferedReader br = new BufferedReader(isr); - String str = br.readLine(); - switch (str) { - case "exit": - System.out.println("see you"); - System.exit(0); - break; - case "trees": - showTrees(); - default: - parse(str); + InputStreamReader isr = new InputStreamReader(System.in); + BufferedReader br = new BufferedReader(isr); + String str = br.readLine(); + switch (str) { + case "exit": + System.out.println("see you"); + System.exit(0); + break; + case "trees": + showTrees(); + default: + parse(str); + } + } catch (Exception e) { + e.printStackTrace(); + System.out.println("不正な入力です"); } } } @@ -348,6 +353,7 @@ public boolean hasNext() { return count < keys.length; } + @Override public String next() { String tmp = keys[count]; @@ -367,11 +373,4 @@ } - -// private void where(Iterator<String> iterator,LinkedList<String> keys ,LinkedList<String> treeNames) { -// LinkedList<String> conditions = new LinkedList<>(); -// while (iterator.hasNext()) { -// String str = iterator.next(); -// } - }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/commandline/main.java Thu Feb 18 14:08:01 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/commandline/main.java Sun Feb 21 18:28:01 2016 +0900 @@ -3,7 +3,7 @@ import java.io.IOException; public class main { - public static void main(String args[]) throws IOException { + public static void main(String args[]) throws IOException, InterruptedException { commandline cmd = new commandline(); cmd.start(); }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/xml/reader/ReadXmlHandler.java Thu Feb 18 14:08:01 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/xml/reader/ReadXmlHandler.java Sun Feb 21 18:28:01 2016 +0900 @@ -34,18 +34,18 @@ Either<Error, JungleTreeEditor> either = editor.addNewChildAt(path, num); if (either.isA()) { - // error + System.out.println("error"); } this.editor = either.b(); path = path.add(num); - if (qName != "") { + if (!qName.equals("")) { elementName = qName; Either<Error, JungleTreeEditor> newEither = editor.putAttribute(path, "element", ByteBuffer.wrap(qName.getBytes())); if (newEither.isA()) { - // error + System.out.println("error"); } this.editor = newEither.b(); } @@ -57,7 +57,7 @@ ByteBuffer bValue = ByteBuffer.wrap(value.getBytes()); Either<Error, JungleTreeEditor> newEither = editor.putAttribute(path, key, bValue); if (newEither.isA()) { - // error + System.out.println("error"); } this.editor = newEither.b(); } @@ -81,7 +81,7 @@ Either<Error, JungleTreeEditor> newEither = editor.putAttribute(onePath,elementName, ByteBuffer.wrap(splitStr.getBytes())); if (newEither.isA()) { - // error + System.out.println("error"); } this.editor = newEither.b(); @@ -100,7 +100,7 @@ public void endDocument() { Either<Error, JungleTreeEditor> either = editor.success(); if (either.isA()) { - // error + System.out.println("error"); } }