int (MyText o) { String superType = getSuperType(); if (superType.equals(o.getSuperType())) { return this.name.compareTo(o.name); } else if (superType.equals("a")) { return -1; } else if (superType.equals("b")) { return 1; } else if (superType.equals("c")) { return o.getSuperType().equals("a") ? 1 : -1; } else { return 0; } }