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

Method equals

src/java/simpledb/storage/TupleDesc.java:226–241  ·  view source on GitHub ↗

比较type Compares the specified object with this TupleDesc for equality. Two TupleDescs are considered equal if they have the same number of items and if the i-th type in this TupleDesc is equal to the i-th type in o for every i. @param o the Object to be compared for equality with this Tu

(Object o)

Source from the content-addressed store, hash-verified

224 */
225
226 public boolean equals(Object o) {
227 // some code goes here
228 if (o instanceof TupleDesc){
229 List<TDItem> tupleDescList = ((TupleDesc) o).tupleDescList;
230 if(tupleDescList.size()==this.tupleDescList.size()){
231 for(int i=0;i<this.tupleDescList.size();i++){
232 if(!this.tupleDescList.get(i).getFieldType().equals(tupleDescList.get(i).getFieldType())){
233 return false;
234 }
235 }
236 return true;
237 }
238 }
239
240 return false;
241 }
242
243 public int hashCode() {
244 // If you want to use TupleDesc as keys for HashMap, implement this so

Callers

nothing calls this directly

Calls 3

getMethod · 0.80
equalsMethod · 0.65
getFieldTypeMethod · 0.45

Tested by

no test coverage detected