/** * {@inheritDoc} * * Comparisons for this class are defined to be type-major (if the * types don't match then the objects are not equal), with * {@link #compareTo0} deciding same-type comparisons. */ @Override public final boolean equals(Object other) { if (this == other) { return true; } OffsettedItem otherItem = (OffsettedItem) other; ItemType thisType = itemType(); ItemType otherType = otherItem.itemType(); if (thisType != otherType) { return false; } return (compareTo0(otherItem) == 0); }
/** * {@inheritDoc} * * Comparisons for this class are defined to be type-major (if the * types don't match then the objects are not equal), with * {@link #compareTo0} deciding same-type comparisons. */ @Override public final boolean equals(Object other) { if (this == other) { return true; } OffsettedItem otherItem = (OffsettedItem) other; ItemType thisType = itemType(); ItemType otherType = otherItem.itemType(); if (thisType != otherType) { return false; } return (compareTo0(otherItem) == 0); }
/** * {@inheritDoc} * * Comparisons for this class are defined to be type-major (if the * types don't match then the objects are not equal), with * {@link #compareTo0} deciding same-type comparisons. */ @Override public final boolean equals(Object other) { if (this == other) { return true; } OffsettedItem otherItem = (OffsettedItem) other; ItemType thisType = itemType(); ItemType otherType = otherItem.itemType(); if (thisType != otherType) { return false; } return (compareTo0(otherItem) == 0); }
/** * {@inheritDoc} * * Comparisons for this class are defined to be type-major (if the * types don't match then the objects are not equal), with * {@link #compareTo0} deciding same-type comparisons. */ @Override public final boolean equals(Object other) { if (this == other) { return true; } OffsettedItem otherItem = (OffsettedItem) other; ItemType thisType = itemType(); ItemType otherType = otherItem.itemType(); if (thisType != otherType) { return false; } return (compareTo0(otherItem) == 0); }
/** * {@inheritDoc} * * Comparisons for this class are defined to be type-major (if the * types don't match then the objects are not equal), with * {@link #compareTo0} deciding same-type comparisons. */ @Override public final boolean equals(Object other) { if (this == other) { return true; } OffsettedItem otherItem = (OffsettedItem) other; ItemType thisType = itemType(); ItemType otherType = otherItem.itemType(); if (thisType != otherType) { return false; } return (compareTo0(otherItem) == 0); }
/** * {@inheritDoc} * * Comparisons for this class are defined to be class-major (if the * classes don't match then the objects are not equal), with * {@link #compareTo0} deciding same-class comparisons. */ public final int compareTo(OffsettedItem other) { if (this == other) { return 0; } ItemType thisType = itemType(); ItemType otherType = other.itemType(); if (thisType != otherType) { return thisType.compareTo(otherType); } return compareTo0(other); }
/** * {@inheritDoc} * * Comparisons for this class are defined to be class-major (if the * classes don't match then the objects are not equal), with * {@link #compareTo0} deciding same-class comparisons. */ public final int compareTo(OffsettedItem other) { if (this == other) { return 0; } ItemType thisType = itemType(); ItemType otherType = other.itemType(); if (thisType != otherType) { return thisType.compareTo(otherType); } return compareTo0(other); }
/** * {@inheritDoc} * * Comparisons for this class are defined to be class-major (if the * classes don't match then the objects are not equal), with * {@link #compareTo0} deciding same-class comparisons. */ public final int compareTo(OffsettedItem other) { if (this == other) { return 0; } ItemType thisType = itemType(); ItemType otherType = other.itemType(); if (thisType != otherType) { return thisType.compareTo(otherType); } return compareTo0(other); }
/** * {@inheritDoc} * * Comparisons for this class are defined to be class-major (if the * classes don't match then the objects are not equal), with * {@link #compareTo0} deciding same-class comparisons. */ @Override public final int compareTo(OffsettedItem other) { if (this == other) { return 0; } ItemType thisType = itemType(); ItemType otherType = other.itemType(); if (thisType != otherType) { return thisType.compareTo(otherType); } return compareTo0(other); }
/** * {@inheritDoc} * * Comparisons for this class are defined to be class-major (if the * classes don't match then the objects are not equal), with * {@link #compareTo0} deciding same-class comparisons. */ public final int compareTo(OffsettedItem other) { if (this == other) { return 0; } ItemType thisType = itemType(); ItemType otherType = other.itemType(); if (thisType != otherType) { return thisType.compareTo(otherType); } return compareTo0(other); }
/** * {@inheritDoc} * * Comparisons for this class are defined to be class-major (if the * classes don't match then the objects are not equal), with * {@link #compareTo0} deciding same-class comparisons. */ public final int compareTo(OffsettedItem other) { if (this == other) { return 0; } ItemType thisType = itemType(); ItemType otherType = other.itemType(); if (thisType != otherType) { return thisType.compareTo(otherType); } return compareTo0(other); }
/** * Writes an index of contents of the items in this instance of the * given type. If there are none, this writes nothing. If there are any, * then the index is preceded by the given intro string. * * @param out {@code non-null;} where to write to * @param itemType {@code non-null;} the item type of interest * @param intro {@code non-null;} the introductory string for non-empty indices */ public void writeIndexAnnotation(AnnotatedOutput out, ItemType itemType, String intro) { throwIfNotPrepared(); TreeMap<String, OffsettedItem> index = new TreeMap<String, OffsettedItem>(); for (OffsettedItem item : items) { if (item.itemType() == itemType) { String label = item.toHuman(); index.put(label, item); } } if (index.size() == 0) { return; } out.annotate(0, intro); for (Map.Entry<String, OffsettedItem> entry : index.entrySet()) { String label = entry.getKey(); OffsettedItem item = entry.getValue(); out.annotate(0, item.offsetString() + ' ' + label + '\n'); } }