Find the index of the field with a given name. @param name name of the field. @return the index of the field that is first to have the given name. @throws NoSuchElementException if no field with a matching name is found.
(String name)
| 161 | * if no field with a matching name is found. |
| 162 | */ |
| 163 | public int fieldNameToIndex(String name) throws NoSuchElementException { |
| 164 | // some code goes here |
| 165 | if(name==null){ |
| 166 | throw new NoSuchElementException(); |
| 167 | } |
| 168 | for(int i=0;i<this.tupleDescList.size();i++){ |
| 169 | String fieldName = this.tupleDescList.get(i).getFieldName(); |
| 170 | if(fieldName==null){ |
| 171 | continue; |
| 172 | } |
| 173 | if(fieldName.equals(name)){ |
| 174 | return i; |
| 175 | } |
| 176 | } |
| 177 | throw new NoSuchElementException(); |
| 178 | } |
| 179 | |
| 180 | /** |
| 181 | * 获取所有元数据的字节大小 |