/** {@inheritDoc} */ public int compareTo(TypeListItem o) { if (o == null) { return 1; } int thisSize = typeList.length; int otherSize = o.typeList.length; int size = Math.min(thisSize, otherSize); for (int i = 0; i < size; i++) { int result = typeList[i].compareTo(o.typeList[i]); if (result != 0) { return result; } } if (thisSize < otherSize) { return -1; } else if (thisSize > otherSize) { return 1; } else { return 0; } }
/** {@inheritDoc} */ public int compareTo(ProtoIdItem o) { int result = returnType.compareTo(o.returnType); if (result != 0) { return result; } if (parameters == null) { if (o.parameters == null) { return 0; } return -1; } else if (o.parameters == null) { return 1; } return parameters.compareTo(o.parameters); }
/** {@inheritDoc} */ public int compareTo(MethodIdItem o) { int result = classType.compareTo(o.classType); if (result != 0) { return result; } result = methodName.compareTo(o.methodName); if (result != 0) { return result; } return methodPrototype.compareTo(o.methodPrototype); }
public int compare(ClassDefItem a, ClassDefItem b) { return a.getClassType().compareTo(b.getClassType()); } });
/** {@inheritDoc} */ protected int compareValue(EncodedValue o) { AnnotationEncodedSubValue other = (AnnotationEncodedSubValue)o; int comp = annotationType.compareTo(other.annotationType); if (comp != 0) { return comp; } comp = names.length - other.names.length; if (comp != 0) { return comp; } for (int i=0; i<names.length; i++) { comp = names[i].compareTo(other.names[i]); if (comp != 0) { return comp; } comp = values[i].compareTo(other.values[i]); if (comp != 0) { return comp; } } return comp; }
/** {@inheritDoc} */ protected int compareValue(EncodedValue o) { TypeEncodedValue other = (TypeEncodedValue)o; return value.compareTo(other.value); }
/** {@inheritDoc} */ public int compareTo(TypeListItem o) { if (o == null) { return 1; } int thisSize = typeList.length; int otherSize = o.typeList.length; int size = Math.min(thisSize, otherSize); for (int i = 0; i < size; i++) { int result = typeList[i].compareTo(o.typeList[i]); if (result != 0) { return result; } } if (thisSize < otherSize) { return -1; } else if (thisSize > otherSize) { return 1; } else { return 0; } }
/** {@inheritDoc} */ public int compareTo(ProtoIdItem o) { int result = returnType.compareTo(o.returnType); if (result != 0) { return result; } if (parameters == null) { if (o.parameters == null) { return 0; } return -1; } else if (o.parameters == null) { return 1; } return parameters.compareTo(o.parameters); }
/** {@inheritDoc} */ public int compareTo(MethodIdItem o) { int result = classType.compareTo(o.classType); if (result != 0) { return result; } result = methodName.compareTo(o.methodName); if (result != 0) { return result; } return methodPrototype.compareTo(o.methodPrototype); }
/** {@inheritDoc} */ protected int compareValue(EncodedValue o) { AnnotationEncodedSubValue other = (AnnotationEncodedSubValue)o; int comp = annotationType.compareTo(other.annotationType); if (comp != 0) { return comp; } comp = names.length - other.names.length; if (comp != 0) { return comp; } for (int i=0; i<names.length; i++) { comp = names[i].compareTo(other.names[i]); if (comp != 0) { return comp; } comp = values[i].compareTo(other.values[i]); if (comp != 0) { return comp; } } return comp; }
public int placeSection(int offset) { currentOffset = offset; if (section.DexFile.getSortAllItems()) { //presort the list, to guarantee a unique ordering Collections.sort(section.items, new Comparator<ClassDefItem>() { public int compare(ClassDefItem a, ClassDefItem b) { return a.getClassType().compareTo(b.getClassType()); } }); } //we need to initialize the offset for all the classes to -1, so we can tell which ones //have been placed for (ClassDefItem classDefItem: section.items) { classDefItem.offset = -1; } for (ClassDefItem classDefItem: section.items) { placeClass(classDefItem); } for (ClassDefItem classDefItem: unplacedClassDefsByType.values()) { section.items.set(classDefItem.getIndex(), classDefItem); } return currentOffset; }
Preconditions.checkState(parent == null || parent.compareTo(classDefItem) == 0 || isEmpty()); parent = classDefItem;
/** {@inheritDoc} */ public int compareTo(ClassDataItem other) { // An empty CodeDataItem may be shared by multiple ClassDefItems, so we can't use parent in this case if (isEmpty()) { if (other.isEmpty()) { return 0; } return -1; } if (other.isEmpty()) { return 1; } if (parent == null) { if (other.parent == null) { return 0; } return -1; } if (other.parent == null) { return 1; } return parent.compareTo(other.parent); }