MCPcopy Create free account
hub / github.com/1345414527/MIT6.830 / fieldNameToIndex

Method fieldNameToIndex

src/java/simpledb/storage/TupleDesc.java:163–178  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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 * 获取所有元数据的字节大小

Callers 6

nameToIdMethod · 0.95
disambiguateNameMethod · 0.95
physicalPlanMethod · 0.95
instantiateJoinMethod · 0.80

Calls 3

getMethod · 0.80
equalsMethod · 0.65
getFieldNameMethod · 0.45

Tested by 1

nameToIdMethod · 0.76