作業部屋の使い方を試しています。
(empty log message)
| @@ -53,7 +53,7 @@ | ||
| 53 | 53 | |
| 54 | 54 | // メンバ変数表示 |
| 55 | 55 | public void disp() { |
| 56 | - for(int i = 1; i <= tc.size(); i++) { | |
| 56 | + for(int i = 0; i < tc.size(); i++) { | |
| 57 | 57 | tc.get(i); |
| 58 | 58 | System.out.println(" " + i + " tag: " + tc.gettag().toString() + |
| 59 | 59 | " id: " + tc.getid() + " class: " + tc.getclass()); |
| @@ -204,13 +204,14 @@ | ||
| 204 | 204 | System.out.println("* HtmlTagSearchTest: test method 4 - get"); |
| 205 | 205 | |
| 206 | 206 | testdata(); |
| 207 | - tc.get(8); | |
| 207 | + tc.get(7); | |
| 208 | 208 | assertEquals(HTML.Tag.DIV, tc.gettag()); |
| 209 | 209 | assertEquals("div-dataid1", tc.getid()); |
| 210 | 210 | assertEquals(null, tc.getclass()); |
| 211 | 211 | |
| 212 | - // 引数 > tc.size() の時、直前の値のままになっていること | |
| 213 | - tc.get(10); | |
| 212 | + // 引数 >= tc.size() の時、直前の値のままになっていること | |
| 213 | + int i = tc.size(); | |
| 214 | + tc.get(i); | |
| 214 | 215 | assertEquals(HTML.Tag.DIV, tc.gettag()); |
| 215 | 216 | assertEquals("div-dataid1", tc.getid()); |
| 216 | 217 | assertEquals(null, tc.getclass()); |
| @@ -224,7 +225,7 @@ | ||
| 224 | 225 | System.out.println("* HtmlTagSearchTest: test method 5 - gettag"); |
| 225 | 226 | |
| 226 | 227 | testdata(); |
| 227 | - tc.get(6); | |
| 228 | + tc.get(5); | |
| 228 | 229 | assertEquals(HTML.Tag.TH, tc.gettag()); |
| 229 | 230 | } |
| 230 | 231 |
| @@ -248,7 +249,7 @@ | ||
| 248 | 249 | System.out.println("* HtmlTagSearchTest: test method 7 - getclass"); |
| 249 | 250 | |
| 250 | 251 | testdata(); |
| 251 | - tc.get(9); | |
| 252 | + tc.get(8); | |
| 252 | 253 | assertEquals("div-dataclass1", tc.getclass()); |
| 253 | 254 | } |
| 254 | 255 |
| @@ -73,40 +73,44 @@ | ||
| 73 | 73 | |
| 74 | 74 | public boolean searchall(HTML.Tag Tag, String Id, String Class) { |
| 75 | 75 | |
| 76 | - boolean chkflg = false; | |
| 77 | 76 | 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 | + } | |
| 82 | 87 | } |
| 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; | |
| 104 | 92 | } |
| 93 | + } else { | |
| 94 | + if(slist1.Id.equals(Id)) { | |
| 95 | + chkflg[1] = true; | |
| 96 | + } | |
| 105 | 97 | } |
| 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 | + } | |
| 107 | 112 | } |
| 108 | 113 | return false; |
| 109 | - */ | |
| 110 | 114 | } |
| 111 | 115 | |
| 112 | 116 | public boolean searchid(HTML.Tag Tag, String Id) { |