1 package org.musicontroller.gui.edit;
2
3
4
5
6
7
8
9
10
11
12
13 public class AiRelationBean implements Comparable<AiRelationBean> {
14
15 private String _firstname;
16 private String _lastname;
17 private String _instruments;
18 private TrackList _tracks;
19
20 public AiRelationBean() {
21 _tracks = new TrackList();
22 }
23
24
25
26
27
28 public void setFirstName(String firstname) {
29 _firstname = firstname;
30 }
31
32
33
34
35
36 public String getFirstName() {
37 return _firstname;
38 }
39
40
41
42
43
44 public void setLastName(String lastname) {
45 _lastname = lastname;
46 }
47
48
49
50
51
52 public String getLastName() {
53 return _lastname;
54 }
55
56
57
58
59
60 public void setInstruments(String instruments) {
61 _instruments = instruments;
62 }
63
64
65
66
67
68 public String getInstruments() {
69 return _instruments;
70 }
71
72
73
74
75
76 public TrackList getTracklist() {
77 return _tracks;
78 }
79
80
81
82
83
84 public void setTracklist(TrackList tracks) {
85 this._tracks = tracks;
86 }
87
88
89
90
91
92 public boolean equals(Object o) {
93 if (o instanceof AiRelationBean) {
94 AiRelationBean other = (AiRelationBean) o;
95
96 return (_firstname==null ? other._firstname==null : _firstname.equals(other._firstname)) &&
97 (_lastname==null ? other._lastname==null : _lastname.equals(other._lastname)) &&
98 (_instruments==null ? other._instruments==null : _instruments.equals(other._instruments)) &&
99 (_tracks==null ? other._tracks==null : _tracks.equals(other._tracks));
100 } else {
101 return false;
102 }
103 }
104
105
106
107
108
109 public int compareTo(AiRelationBean o) {
110 if(getLastName()==null) {
111 if(o.getLastName()==null) {
112 return 0;
113 } else {
114 return -1;
115 }
116 }
117 if(o.getLastName()==null) {
118 return 1;
119 }
120 int compareLastNames = getLastName().compareTo(o.getLastName());
121 if(compareLastNames==0) {
122 if(getFirstName()==null) {
123 if(o.getFirstName()==null) {
124 return 0;
125 } else {
126 return -1;
127 }
128 }
129 if(o.getFirstName()==null) {
130 return 1;
131 }
132 return getFirstName().compareTo(o.getFirstName());
133 } else {
134 return compareLastNames;
135 }
136 }
137
138 }