/Users/lyon/j4p/src/addBk/addressBook/AddressBookRecord.java
|
1 package addBk.addressBook;
2
3 import java.io.Serializable;
4 import java.util.StringTokenizer;
5
6 public class AddressBookRecord
7 implements
8 // *** un comment on jdk1.2 or better to sort
9 // Comparator,
10 Serializable {
11 String name = "";
12 String address = "";
13 String notes = "";
14 String dial_1 = "";
15 String dial_2 = "";
16 String dial_3 = "";
17
18 public int compareTo(Object o) {
19 AddressBookRecord that = (AddressBookRecord) o;
20 return this.name.compareTo(that.name);
21 }
22
23 public static AddressBookRecord getRecord(
24 String line) {
25
26 AddressBookRecord abr =
27 new AddressBookRecord();
28
29 StringTokenizer st = new StringTokenizer(
30 line, ",");
31 try {
32 abr.name = st.nextToken();
33 abr.address = st.nextToken();
34 abr.notes = st.nextToken();
35 abr.dial_1 = st.nextToken();
36 abr.dial_2 = st.nextToken();
37 abr.dial_3 = st.nextToken();
38 } catch (Exception e) {
39 }
40 ;
41
42 return (abr);
43 }
44 }
45