/** * Compares this date format with the specified object and indicates if they * are equal. * * @param object * the object to compare with this date format. * @return {@code true} if {@code object} is a {@code DateFormat} object and * it has the same properties as this date format; {@code false} * otherwise. * @see #hashCode */ @Override public boolean equals(Object object) { if (this == object) { return true; } if (!(object instanceof DateFormat)) { return false; } DateFormat dateFormat = (DateFormat) object; return numberFormat.equals(dateFormat.numberFormat) && calendar.getTimeZone().equals( dateFormat.calendar.getTimeZone()) && calendar.getFirstDayOfWeek() == dateFormat.calendar .getFirstDayOfWeek() && calendar.getMinimalDaysInFirstWeek() == dateFormat.calendar .getMinimalDaysInFirstWeek() && calendar.isLenient() == dateFormat.calendar.isLenient(); }
@Override public boolean equals(Object obj) { if (obj instanceof NumberFormatJDK) { return ((NumberFormatJDK)obj).fJdkNfmt.equals(fJdkNfmt); } return false; }
@Override public boolean equals(Object obj) { if (obj == this) return true; if (obj instanceof NumericConfig) { NumericConfig other = (NumericConfig) obj; if (this.precisionStep == other.precisionStep && this.type == other.type && (this.format == other.format || (this.format.equals(other.format)))) { return true; } } return false; }
@Override public boolean equals(Object obj) { if (obj == this) return true; if (obj instanceof NumericConfig) { NumericConfig other = (NumericConfig) obj; if (this.precisionStep == other.precisionStep && this.type == other.type && (this.format == other.format || (this.format.equals(other.format)))) { return true; } } return false; }
/** * Overrides equals. * Two NumberFormats are equal if they are of the same class * and the settings (groupingUsed, parseIntegerOnly, maximumIntegerDigits, etc. * are equal. * @param obj the object to compare against * @return true if the object is equal to this. * @stable ICU 2.0 */ public boolean equals(Object obj) { try { return numberFormat.equals(((NumberFormat)obj).numberFormat); } catch (Exception e) { return false; } }
/** * Overrides equals. * Two NumberFormats are equal if they are of the same class * and the settings (groupingUsed, parseIntegerOnly, maximumIntegerDigits, etc. * are equal. * @param obj the object to compare against * @return true if the object is equal to this. * @stable ICU 2.0 */ public boolean equals(Object obj) { try { return numberFormat.equals(((NumberFormat)obj).numberFormat); } catch (Exception e) { return false; } }
@Override public boolean equals(@Nullable Object obj) { return obj instanceof MemoryUnitFormat && this.numberFormat.equals(((MemoryUnitFormat) obj).numberFormat); }
/** * Tests the generator for equality with an arbitrary object. * * @param obj the object to test against ({@code null} permitted). * * @return A boolean. */ @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof AbstractPieItemLabelGenerator)) { return false; } AbstractPieItemLabelGenerator that = (AbstractPieItemLabelGenerator) obj; if (!this.labelFormat.equals(that.labelFormat)) { return false; } if (!this.numberFormat.equals(that.numberFormat)) { return false; } if (!this.percentFormat.equals(that.percentFormat)) { return false; } return true; }
/** * Tests this generator for equality with an arbitrary object. * * @param obj the object ({@code null} permitted). * * @return A boolean. */ @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof StandardCrosshairLabelGenerator)) { return false; } StandardCrosshairLabelGenerator that = (StandardCrosshairLabelGenerator) obj; if (!this.labelTemplate.equals(that.labelTemplate)) { return false; } if (!this.numberFormat.equals(that.numberFormat)) { return false; } return true; }
/** * Tests this generator for equality with an arbitrary object. * * @param obj the object (<code>null</code> permitted). * * @return A boolean. */ public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof StandardCrosshairLabelGenerator)) { return false; } StandardCrosshairLabelGenerator that = (StandardCrosshairLabelGenerator) obj; if (!this.labelTemplate.equals(that.labelTemplate)) { return false; } if (!this.numberFormat.equals(that.numberFormat)) { return false; } return true; }
/** * Tests if this object is equal to another. * * @param obj the other object. * * @return A boolean. */ @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof HighLowItemLabelGenerator)) { return false; } HighLowItemLabelGenerator generator = (HighLowItemLabelGenerator) obj; if (!this.dateFormatter.equals(generator.dateFormatter)) { return false; } if (!this.numberFormatter.equals(generator.numberFormatter)) { return false; } return true; }
/** * Tests this formatter for equality with an arbitrary object. * * @param obj the object ({@code null} permitted). * * @return A boolean. */ @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof NumberTickUnit)) { return false; } if (!super.equals(obj)) { return false; } NumberTickUnit that = (NumberTickUnit) obj; if (!this.formatter.equals(that.formatter)) { return false; } return true; }
/** * Tests if this object is equal to another. * * @param obj the other object. * * @return A boolean. */ public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof HighLowItemLabelGenerator)) { return false; } HighLowItemLabelGenerator generator = (HighLowItemLabelGenerator) obj; if (!this.dateFormatter.equals(generator.dateFormatter)) { return false; } if (!this.numberFormatter.equals(generator.numberFormatter)) { return false; } return true; }
/** * Tests this formatter for equality with an arbitrary object. * * @param obj the object (<code>null</code> permitted). * * @return A boolean. */ public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof NumberTickUnit)) { return false; } if (!super.equals(obj)) { return false; } NumberTickUnit that = (NumberTickUnit) obj; if (!this.formatter.equals(that.formatter)) { return false; } return true; }
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null || getClass() != obj.getClass()) return false; DateFormat other = (DateFormat) obj; return (// calendar.equivalentTo(other.calendar) // THIS API DOESN'T EXIST YET! calendar.getFirstDayOfWeek() == other.calendar.getFirstDayOfWeek() && calendar.getMinimalDaysInFirstWeek() == other.calendar.getMinimalDaysInFirstWeek() && calendar.isLenient() == other.calendar.isLenient() && calendar.getTimeZone().equals(other.calendar.getTimeZone()) && numberFormat.equals(other.numberFormat)); }
/** * Overrides equals */ public boolean equals(Object obj) { if (this == obj) return true; if (obj == null || getClass() != obj.getClass()) return false; DateFormat other = (DateFormat) obj; return (// calendar.equivalentTo(other.calendar) // THIS API DOESN'T EXIST YET! calendar.getFirstDayOfWeek() == other.calendar.getFirstDayOfWeek() && calendar.getMinimalDaysInFirstWeek() == other.calendar.getMinimalDaysInFirstWeek() && calendar.isLenient() == other.calendar.isLenient() && calendar.getTimeZone().equals(other.calendar.getTimeZone()) && numberFormat.equals(other.numberFormat)); }
/** * Overrides equals */ public boolean equals(Object obj) { if (this == obj) return true; if (obj == null || getClass() != obj.getClass()) return false; DateFormat other = (DateFormat) obj; return (// calendar.equivalentTo(other.calendar) // THIS API DOESN'T EXIST YET! calendar.getFirstDayOfWeek() == other.calendar.getFirstDayOfWeek() && calendar.getMinimalDaysInFirstWeek() == other.calendar.getMinimalDaysInFirstWeek() && calendar.isLenient() == other.calendar.isLenient() && calendar.getTimeZone().equals(other.calendar.getTimeZone()) && numberFormat.equals(other.numberFormat)); }
/** * Analyze the negative subpattern of DecimalFormat and set/update values * as necessary. */ private void checkNegativeNumberExpression() { if ((numberFormat instanceof DecimalFormat) && !numberFormat.equals(originalNumberFormat)) { String numberPattern = ((DecimalFormat)numberFormat).toPattern(); if (!numberPattern.equals(originalNumberPattern)) { hasFollowingMinusSign = false; int separatorIndex = numberPattern.indexOf(';'); // If the negative subpattern is not absent, we have to analayze // it in order to check if it has a following minus sign. if (separatorIndex > -1) { int minusIndex = numberPattern.indexOf('-', separatorIndex); if ((minusIndex > numberPattern.lastIndexOf('0')) && (minusIndex > numberPattern.lastIndexOf('#'))) { hasFollowingMinusSign = true; minusSign = ((DecimalFormat)numberFormat).getDecimalFormatSymbols().getMinusSign(); } } originalNumberPattern = numberPattern; } originalNumberFormat = numberFormat; } }
/** * Analyze the negative subpattern of DecimalFormat and set/update values * as necessary. */ private void checkNegativeNumberExpression() { if ((numberFormat instanceof DecimalFormat) && !numberFormat.equals(originalNumberFormat)) { String numberPattern = ((DecimalFormat)numberFormat).toPattern(); if (!numberPattern.equals(originalNumberPattern)) { hasFollowingMinusSign = false; int separatorIndex = numberPattern.indexOf(';'); // If the negative subpattern is not absent, we have to analayze // it in order to check if it has a following minus sign. if (separatorIndex > -1) { int minusIndex = numberPattern.indexOf('-', separatorIndex); if ((minusIndex > numberPattern.lastIndexOf('0')) && (minusIndex > numberPattern.lastIndexOf('#'))) { hasFollowingMinusSign = true; minusSign = ((DecimalFormat)numberFormat).getDecimalFormatSymbols().getMinusSign(); } } originalNumberPattern = numberPattern; } originalNumberFormat = numberFormat; } }
/** * Compares this date format with the specified object and indicates if they * are equal. * * @param object * the object to compare with this date format. * @return {@code true} if {@code object} is a {@code DateFormat} object and * it has the same properties as this date format; {@code false} * otherwise. * @see #hashCode */ @Override public boolean equals(Object object) { if (this == object) { return true; } if (!(object instanceof DateFormat)) { return false; } DateFormat dateFormat = (DateFormat) object; return numberFormat.equals(dateFormat.numberFormat) && calendar.getTimeZone().equals( dateFormat.calendar.getTimeZone()) && calendar.getFirstDayOfWeek() == dateFormat.calendar .getFirstDayOfWeek() && calendar.getMinimalDaysInFirstWeek() == dateFormat.calendar .getMinimalDaysInFirstWeek() && calendar.isLenient() == dateFormat.calendar.isLenient(); }