11package com .nbs .entity ;
22
3+ import com .nbs .utils .CharacterParser ;
4+
35/**
46 * @Package : com.nbs.entity
57 * @Description : <p></p>
68 * @Author : lambor.c
7- * @Date : 2018/6/23-22:44
9+ * @Date : 2018/6/24-9:13
810 * Copyright (c) 2018, NBS , lambor.c<[email protected] >. 911 * All rights reserved.
1012 */
11- public class ContactsItem implements Comparable <ContactsItem >{
12- private String hash ;
13+ public class ContactsItem implements Comparable <ContactsItem > {
14+ /**
15+ * hash58
16+ */
17+ private String id ;
18+
1319 private String name ;
20+
1421 private String type ;
1522
16- private ContactsItem (String hash ) {
17- this .hash = hash ;
18- this .type = TYPE .p .toString ();
19- }
23+ public ContactsItem () { }
2024
21- public ContactsItem (String hash , String name ) {
22- this .hash = hash ;
25+ public ContactsItem (String id , String name ) {
26+ this .id = id ;
2327 this .name = name ;
24- this .type = TYPE .p .toString ();
2528 }
2629
27- public ContactsItem (String hash , String name , String type ) {
28- this .hash = hash ;
30+ public ContactsItem (String id , String name , String type ) {
31+ this .id = id ;
2932 this .name = name ;
3033 this .type = type ;
3134 }
3235
33- public String getHash () {
34- return hash ;
36+ public String getId () {
37+ return id ;
3538 }
3639
37- public void setHash (String hash ) {
38- this .hash = hash ;
40+ public void setId (String id ) {
41+ this .id = id ;
3942 }
4043
4144 public String getName () {
@@ -54,15 +57,30 @@ public void setType(String type) {
5457 this .type = type ;
5558 }
5659
60+ @ Override
61+ public String toString () {
62+ StringBuffer sb = new StringBuffer ();
63+ sb .append ("ContactsItem : {" );
64+ sb .append ("id : " ).append (this .id ==null ? "" : this .id ).append ("," );
65+ sb .append ("name : " ).append (this .name ==null ? "" : this .name ).append ("," );
66+ sb .append ("type : " ).append (this .type ==null ? "" : this .type );
67+ sb .append ("}" );
68+ return sb .toString ();
69+ }
70+
5771 @ Override
5872 public int compareTo (ContactsItem o ) {
59- return 0 ;
73+ if (o ==null )return -1 ;
74+ String tc = CharacterParser .getSelling (this .name ).toUpperCase ();
75+ String oc = CharacterParser .getSelling (o .name ).toUpperCase ();
76+ int r = tc .compareTo (oc );
77+ return 0 ==r ? this .id .compareTo (o .getId ()) : r ;
6078 }
6179
6280 /**
63- * 群、点
81+ *
6482 */
6583 public static enum TYPE {
66- p , q ;
84+ Q , P ;
6785 }
6886}
0 commit comments