• 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

Revision18 (tree)
Time2014-06-12 21:44:46
Authortuna_p

Log Message

(empty log message)

Change Summary

Incremental Difference

--- HtmlTagSearch/test/HtmlParser/HtmlTagSearchTest.java (revision 17)
+++ HtmlTagSearch/test/HtmlParser/HtmlTagSearchTest.java (revision 18)
@@ -53,7 +53,7 @@
5353
5454 // メンバ変数表示
5555 public void disp() {
56- for(int i = 1; i <= tc.size(); i++) {
56+ for(int i = 0; i < tc.size(); i++) {
5757 tc.get(i);
5858 System.out.println(" " + i + " tag: " + tc.gettag().toString() +
5959 " id: " + tc.getid() + " class: " + tc.getclass());
@@ -204,13 +204,14 @@
204204 System.out.println("* HtmlTagSearchTest: test method 4 - get");
205205
206206 testdata();
207- tc.get(8);
207+ tc.get(7);
208208 assertEquals(HTML.Tag.DIV, tc.gettag());
209209 assertEquals("div-dataid1", tc.getid());
210210 assertEquals(null, tc.getclass());
211211
212- // 引数 > tc.size() の時、直前の値のままになっていること
213- tc.get(10);
212+ // 引数 >= tc.size() の時、直前の値のままになっていること
213+ int i = tc.size();
214+ tc.get(i);
214215 assertEquals(HTML.Tag.DIV, tc.gettag());
215216 assertEquals("div-dataid1", tc.getid());
216217 assertEquals(null, tc.getclass());
@@ -224,7 +225,7 @@
224225 System.out.println("* HtmlTagSearchTest: test method 5 - gettag");
225226
226227 testdata();
227- tc.get(6);
228+ tc.get(5);
228229 assertEquals(HTML.Tag.TH, tc.gettag());
229230 }
230231
@@ -248,7 +249,7 @@
248249 System.out.println("* HtmlTagSearchTest: test method 7 - getclass");
249250
250251 testdata();
251- tc.get(9);
252+ tc.get(8);
252253 assertEquals("div-dataclass1", tc.getclass());
253254 }
254255
--- HtmlTagSearch/src/HtmlParser/HtmlTagSearch.java (revision 17)
+++ HtmlTagSearch/src/HtmlParser/HtmlTagSearch.java (revision 18)
@@ -73,40 +73,44 @@
7373
7474 public boolean searchall(HTML.Tag Tag, String Id, String Class) {
7575
76- boolean chkflg = false;
7776 for (structdata slist1 : slist) {
78- if((Tag == slist1.Tag) &&
79- Id.equals(slist1.Id) &&
80- Class.equals(slist1.Class)) {
81- chkflg = true;
77+ boolean chkflg[] = {false, false, false};
78+ // Tag
79+ if(slist1.Tag == null) {
80+ if(Tag == null) {
81+ chkflg[0] = true;
82+ }
83+ } else {
84+ if(slist1.Tag.equals(Tag)) {
85+ chkflg[0] = true;
86+ }
8287 }
83- }
84- return chkflg;
85-
86- /*
87- boolean chkin[] = {false, false, false};
88- if(Tag != null) { chkin[0] = true; }
89- if(Id != null) { chkin[1] = true; }
90- if(Class != null) { chkin[2] = true; }
91-
92- for (structdata slist1 : slist) {
93- boolean chkkey[] = {false, false, false};
94- dat = slist1;
95- if(chkin[0] && (Tag == dat.Tag)) { chkkey[0] = true; }
96- if(chkin[1] && Id.equals(dat.Id)) { chkkey[1] = true; }
97- if(chkin[2] && Class.equals(dat.Class)) { chkkey[2] = true; }
98- boolean chkflg = true;
99- for(int i = 0; i < chkin.length; i++) {
100- if(chkin[i]) {
101- if(chkkey[i] == false) {
102- chkflg = false;
103- }
88+ // Id
89+ if(slist1.Id == null) {
90+ if(Id == null) {
91+ chkflg[1] = true;
10492 }
93+ } else {
94+ if(slist1.Id.equals(Id)) {
95+ chkflg[1] = true;
96+ }
10597 }
106- if(chkflg) return chkflg;
98+ // Class
99+ if(slist1.Class == null) {
100+ if(Class == null) {
101+ chkflg[2] = true;
102+ }
103+ } else {
104+ if(slist1.Class.equals(Class)) {
105+ chkflg[2] = true;
106+ }
107+ }
108+ //
109+ if(chkflg[0] & chkflg[1] & chkflg[2] ) {
110+ return true;
111+ }
107112 }
108113 return false;
109- */
110114 }
111115
112116 public boolean searchid(HTML.Tag Tag, String Id) {