• R/O
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

作業部屋の使い方を試しています。


Commit MetaInfo

Revision10 (tree)
Time2014-06-04 19:01:27
Authortuna_p

Log Message

(empty log message)

Change Summary

Incremental Difference

--- HtmlTest1/src/htmltest1/HtmlParser.java (revision 9)
+++ HtmlTest1/src/htmltest1/HtmlParser.java (revision 10)
@@ -42,9 +42,9 @@
4242 new InputStreamReader(con.getInputStream(), "utf-8"));
4343
4444 String wkline;
45- StringBuffer sb = new StringBuffer();
45+ StringBuilder sb = new StringBuilder();
4646 while((wkline = reader.readLine()) != null) {
47- sb.append(wkline + "\n");
47+ sb.append(wkline).append("\n");
4848 }
4949 pageData = sb.toString();
5050
@@ -52,7 +52,7 @@
5252
5353 System.out.println("exec END");
5454 }
55- catch(Exception e) {
55+ catch(IOException e) {
5656 System.err.println(e);
5757 }
5858 }
@@ -78,7 +78,7 @@
7878 class MyParserCallback extends HTMLEditorKit.ParserCallback {
7979
8080 // Tag毎の階層
81- HashMap<HTML.Tag,Integer> map = new HashMap<HTML.Tag,Integer>();
81+ HashMap<HTML.Tag,Integer> tagMap = new HashMap<>();
8282
8383 @Override
8484 public void handleSimpleTag(HTML.Tag tag, MutableAttributeSet attr, int pos){
@@ -87,10 +87,10 @@
8787 StringBuffer strBuf = new StringBuffer();
8888 String ret;
8989
90- strBuf.append("x : S : " + tag.toString());
90+ strBuf.append("x : S : ").append(tag.toString());
9191 ret = (String)attr.getAttribute(HTML.Attribute.VALUE);
9292 if(ret != null) {
93- strBuf.append(" [VALUE] " + ret);
93+ strBuf.append(" [VALUE] ").append(ret);
9494 }
9595 System.out.println(strBuf);
9696
@@ -100,28 +100,28 @@
100100 public void handleStartTag(HTML.Tag tag, MutableAttributeSet attr, int pos){
101101 // Tag毎の階層を保持
102102 int count = 1;
103- if(map.containsKey(tag)) {
104- count = map.get(tag);
103+ if(tagMap.containsKey(tag)) {
104+ count = tagMap.get(tag);
105105 count++;
106106 }
107- map.put(tag, count);
107+ tagMap.put(tag, count);
108108
109109
110110 StringBuffer strBuf = new StringBuffer();
111111 String ret;
112112
113- strBuf.append(count + " : F : " + tag.toString());
113+ strBuf.append(count).append(" : F : ").append(tag.toString());
114114 ret = (String)attr.getAttribute(HTML.Attribute.ID);
115115 if(ret != null) {
116- strBuf.append(" [ID] " + ret);
116+ strBuf.append(" [ID] ").append(ret);
117117 }
118118 ret = (String)attr.getAttribute(HTML.Attribute.CLASS);
119119 if(ret != null) {
120- strBuf.append(" [CLASS] " + ret);
120+ strBuf.append(" [CLASS] ").append(ret);
121121 }
122122 ret = (String)attr.getAttribute(HTML.Attribute.VALUE);
123123 if(ret != null) {
124- strBuf.append(" [VALUE] " + ret);
124+ strBuf.append(" [VALUE] ").append(ret);
125125 }
126126 System.out.println(strBuf);
127127
@@ -131,8 +131,8 @@
131131 public void handleEndTag(HTML.Tag tag, int pos){
132132 // Tag毎の階層を取得
133133 int count = 0;
134- if(map.containsKey(tag)) {
135- count = map.get(tag);
134+ if(tagMap.containsKey(tag)) {
135+ count = tagMap.get(tag);
136136 }
137137
138138
@@ -141,7 +141,7 @@
141141 System.out.println(count + " : E : " + tag.toString());
142142
143143 // Tag毎の階層減算
144- map.put(tag, --count);
144+ tagMap.put(tag, --count);
145145 }
146146
147147 @Override