MCPcopy Create free account
hub / github.com/GraxCode/zelixkiller / findCommonParent

Method findCommonParent

src/me/lpk/util/ParentUtils.java:237–251  ·  view source on GitHub ↗
(MappedClass mc1, MappedClass mc2)

Source from the content-addressed store, hash-verified

235 }
236
237 public static MappedClass findCommonParent(MappedClass mc1, MappedClass mc2) {
238 // Are they the same?
239 if (mc1.getNewName().equals(mc2.getNewName())) {
240 return mc1;
241 }
242 // Does m1 extend or implement anything m2 does?
243 for (String parentNames1 : getParents(mc1)) {
244 for (String parentNames2 : getParents(mc2)) {
245 if (parentNames1.equals(parentNames2)) {
246 return getParent(parentNames1, mc1);
247 }
248 }
249 }
250 return null;
251 }
252
253 private static MappedClass getParent(String n, MappedClass m) {
254 while (m != null) {

Callers 2

getCommonSuperClassMethod · 0.95
isChildMethod · 0.95

Calls 4

getParentsMethod · 0.95
getParentMethod · 0.95
getNewNameMethod · 0.80
equalsMethod · 0.45

Tested by

no test coverage detected