public class SortedGenericSourceContact extends GenericSourceContact implements java.lang.Comparable<SourceContact>
contactDetails
DATA_ID
Constructor and Description |
---|
SortedGenericSourceContact(ContactQuery parentQuery,
ContactSourceService cSourceService,
java.lang.String displayName,
java.util.List<ContactDetail> contactDetails)
Creates an instance of ProtocolSourceContact.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(SourceContact o)
Compares this contact with the specified object for order.
|
int |
getIndex()
Returns the index of this source contact in its parent group.
|
getContactAddress, getContactDetails, getContactDetails, getContactDetails, getContactSource, getDisplayDetails, getDisplayName, getImage, getPreferredContactDetail, getPresenceStatus, isDefaultImage, setContactAddress, setDisplayDetails, setDisplayName, setImage, setPresenceStatus
getData, setData
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getData, setData
public SortedGenericSourceContact(ContactQuery parentQuery, ContactSourceService cSourceService, java.lang.String displayName, java.util.List<ContactDetail> contactDetails)
parentQuery
- the parent ContactQuery, which generated
this result contactcSourceService
- the parent ContactSourceService, of
which this source contact is partdisplayName
- the display name of the contactcontactDetails
- the list of contact detailspublic int compareTo(SourceContact o)
The result of this method is calculated the following way:
( (10 - isOnline) - (10 - targetIsOnline)) * 100000000
+ getDisplayName()
.compareToIgnoreCase(target.getDisplayName()) * 10000
+ compareDDetails * 1000
+ String.valueOf(hashCode())
.compareToIgnoreCase(String.valueOf(o.hashCode()))
Or in other words ordering of source contacts would be first done by presence status, then display name, then display details and finally (in order to avoid equalities) be the hashCode of the object.
compareTo
in interface java.lang.Comparable<SourceContact>
o
- the SourceContact
to be compared.public int getIndex()
getIndex
in interface SourceContact
getIndex
in class GenericSourceContact
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.