@Test public void testCompareTo() { PropertyClass one = new PropertyClass(); PropertyClass two = new PropertyClass(); int n1, n2; one.setName("first"); two.setName("second"); Random random = new Random(); for (int i = 0; i < 20; ++i) { n1 = random.nextInt(); n2 = random.nextInt(); one.setNumber(n1); two.setNumber(n2); if (n1 == n2) { assertEquals(Math.signum(one.compareTo(two)), -1.0); assertEquals(Math.signum(two.compareTo(one)), 1.0); } else { assertEquals(0, Float.compare(Math.signum(one.compareTo(two)), Math.signum(n1 - n2))); assertEquals(0, Float.compare(Math.signum(two.compareTo(one)), Math.signum(n2 - n1))); } } one.setNumber(42); two.setNumber(42); assertEquals(Math.signum(one.compareTo(two)), -1.0); assertEquals(Math.signum(two.compareTo(one)), 1.0); }
@Override public int compareTo(PropertyClass other) { int result = this.getNumber() - other.getNumber(); if (result == 0) { result = this.getName().compareTo(other.getName()); } return result; }
PropertyClass extends BaseCollection<ClassPropertyReference> implements PropertyClassInterface, Comparable<PropertyClass> { @Override public int compareTo(PropertyClass other) { int result = this.getNumber() - other.getNumber(); if (result == 0) { result = this.getName().compareTo(other.getName()); } return result; } }
PropertyClass extends BaseCollection<ClassPropertyReference> implements PropertyClassInterface, Comparable<PropertyClass> { @Override public int compareTo(PropertyClass other) { int result = this.getNumber() - other.getNumber(); if (result == 0) { result = this.getName().compareTo(other.getName()); } return result; } PropertyClass();  PropertyClass(String name, String prettyname, PropertyMetaClass xWikiClass); }
PropertyClass extends BaseCollection<ClassPropertyReference> implements PropertyClassInterface, Comparable<PropertyClass> { @Override public int compareTo(PropertyClass other) { int result = this.getNumber() - other.getNumber(); if (result == 0) { result = this.getName().compareTo(other.getName()); } return result; } PropertyClass();  PropertyClass(String name, String prettyname, PropertyMetaClass xWikiClass); @Override BaseClass getXClass(XWikiContext context); BaseClass getxWikiClass(); void setxWikiClass(BaseClass xWikiClass); @Override BaseCollection getObject(); @Override void setObject(BaseCollection object); String getFieldFullName(); @Override long getId(); @Override void setId(long id); @Override String toString(BaseProperty property); @Override BaseProperty fromString(String value); BaseProperty newPropertyfromXML(Element ppcel); @Override void displayHidden(StringBuffer buffer, String name, String prefix, BaseCollection object,
        XWikiContext context); @Override void displayView(StringBuffer buffer, String name, String prefix, BaseCollection object,
        XWikiContext context); @Override void displayEdit(StringBuffer buffer, String name, String prefix, BaseCollection object,
        XWikiContext context); String displayHidden(String name, String prefix, BaseCollection object, XWikiContext context); String displayHidden(String name, BaseCollection object, XWikiContext context); String displayView(String name, String prefix, BaseCollection object, XWikiContext context); String displayView(String name, BaseCollection object, XWikiContext context); String displayEdit(String name, String prefix, BaseCollection object, XWikiContext context); String displayEdit(String name, BaseCollection object, XWikiContext context); boolean isCustomDisplayed(XWikiContext context); void displayCustom(StringBuffer buffer, String fieldName, String prefix, String type, BaseObject object,
        final XWikiContext context); @Override String getClassName(); @Override String getName(); @Override void setName(String name); String getCustomDisplay(); void setCustomDisplay(String value); @Override String getPrettyName(); String getPrettyName(XWikiContext context); String getTranslatedPrettyName(XWikiContext context); @Override void setPrettyName(String prettyName); String getHint(); void setHint(String hint); String getTooltip(); String getTooltip(XWikiContext context); void setTooltip(String tooltip); @Override int getNumber(); @Override void setNumber(int number); String getClassType(); @Deprecated void setClassType(String type); @Override PropertyClass clone(); @Override Element toXML(BaseClass bclass); @Override Element toXML(); @Override void fromXML(Element element); @Override String toFormString(); void initLazyCollections(); boolean isUnmodifiable(); void setUnmodifiable(boolean unmodifiable); boolean isDisabled(); void setDisabled(boolean disabled); BaseProperty fromStringArray(String[] strings); boolean isValidColumnTypes(Property hibprop); @Override BaseProperty fromValue(Object value); @Override BaseProperty newProperty(); void setValidationRegExp(String validationRegExp); String getValidationRegExp(); String getValidationMessage(); void setValidationMessage(String validationMessage); boolean validateProperty(BaseProperty property, XWikiContext context); @Override void flushCache(); @Override int compareTo(PropertyClass other); void mergeProperty(BaseProperty<T> currentProperty,
        BaseProperty<T> previousProperty, BaseProperty<T> newProperty, MergeConfiguration configuration,
        XWikiContext context, MergeResult mergeResult); }
PropertyClass extends BaseCollection<ClassPropertyReference> implements PropertyClassInterface, Comparable<PropertyClass> { @Override public int compareTo(PropertyClass other) { int result = this.getNumber() - other.getNumber(); if (result == 0) { result = this.getName().compareTo(other.getName()); } return result; } PropertyClass();  PropertyClass(String name, String prettyname, PropertyMetaClass xWikiClass); @Override BaseClass getXClass(XWikiContext context); BaseClass getxWikiClass(); void setxWikiClass(BaseClass xWikiClass); @Override BaseCollection getObject(); @Override void setObject(BaseCollection object); String getFieldFullName(); @Override long getId(); @Override void setId(long id); @Override String toString(BaseProperty property); @Override BaseProperty fromString(String value); BaseProperty newPropertyfromXML(Element ppcel); @Override void displayHidden(StringBuffer buffer, String name, String prefix, BaseCollection object,
        XWikiContext context); @Override void displayView(StringBuffer buffer, String name, String prefix, BaseCollection object,
        XWikiContext context); @Override void displayEdit(StringBuffer buffer, String name, String prefix, BaseCollection object,
        XWikiContext context); String displayHidden(String name, String prefix, BaseCollection object, XWikiContext context); String displayHidden(String name, BaseCollection object, XWikiContext context); String displayView(String name, String prefix, BaseCollection object, XWikiContext context); String displayView(String name, BaseCollection object, XWikiContext context); String displayEdit(String name, String prefix, BaseCollection object, XWikiContext context); String displayEdit(String name, BaseCollection object, XWikiContext context); boolean isCustomDisplayed(XWikiContext context); void displayCustom(StringBuffer buffer, String fieldName, String prefix, String type, BaseObject object,
        final XWikiContext context); @Override String getClassName(); @Override String getName(); @Override void setName(String name); String getCustomDisplay(); void setCustomDisplay(String value); @Override String getPrettyName(); String getPrettyName(XWikiContext context); String getTranslatedPrettyName(XWikiContext context); @Override void setPrettyName(String prettyName); String getHint(); void setHint(String hint); String getTooltip(); String getTooltip(XWikiContext context); void setTooltip(String tooltip); @Override int getNumber(); @Override void setNumber(int number); String getClassType(); @Deprecated void setClassType(String type); @Override PropertyClass clone(); @Override Element toXML(BaseClass bclass); @Override Element toXML(); @Override void fromXML(Element element); @Override String toFormString(); void initLazyCollections(); boolean isUnmodifiable(); void setUnmodifiable(boolean unmodifiable); boolean isDisabled(); void setDisabled(boolean disabled); BaseProperty fromStringArray(String[] strings); boolean isValidColumnTypes(Property hibprop); @Override BaseProperty fromValue(Object value); @Override BaseProperty newProperty(); void setValidationRegExp(String validationRegExp); String getValidationRegExp(); String getValidationMessage(); void setValidationMessage(String validationMessage); boolean validateProperty(BaseProperty property, XWikiContext context); @Override void flushCache(); @Override int compareTo(PropertyClass other); void mergeProperty(BaseProperty<T> currentProperty,
        BaseProperty<T> previousProperty, BaseProperty<T> newProperty, MergeConfiguration configuration,
        XWikiContext context, MergeResult mergeResult);  }