3232 * to identify the type of ID
3333 *
3434 * @author Scooter Willis
35+ * @author Jacek Grzebyta
3536 */
3637public class AccessionID {
3738
3839 private String id = null ;
3940 private DataSource source = DataSource .LOCAL ;
41+ private Integer version ;
42+ private String identifier = null ;
4043
4144 /**
4245 *
@@ -55,6 +58,7 @@ public AccessionID(String id) {
5558 this .id = id .trim ();
5659 this .source = DataSource .LOCAL ;
5760 }
61+
5862
5963 /**
6064 *
@@ -65,6 +69,13 @@ public AccessionID(String id, DataSource source) {
6569 this .id = id .trim ();
6670 this .source = source ;
6771 }
72+
73+ public AccessionID (String id , DataSource source , Integer version , String identifier ) {
74+ this .id = id ;
75+ this .source = source ;
76+ this .version = version ;
77+ this .identifier = identifier ;
78+ }
6879
6980 /**
7081 * @return the id
@@ -86,8 +97,10 @@ public boolean equals(Object o) {
8697 if (Equals .classEqual (this , o )) {
8798 AccessionID l = (AccessionID ) o ;
8899 equals = (Equals .equal (getID (), l .getID ())
89- && Equals .equal (getDataSource (), l .getDataSource ()));
90- }
100+ && Equals .equal (getDataSource (), l .getDataSource ())
101+ && Equals .equal (getIdentifier (), l .getIdentifier ())
102+ && Equals .equal (getVersion (), l .getVersion ()));
103+ }
91104 return equals ;
92105 }
93106
@@ -96,13 +109,42 @@ public int hashCode() {
96109 int r = Hashcoder .SEED ;
97110 r = Hashcoder .hash (r , getID ());
98111 r = Hashcoder .hash (r , getDataSource ());
112+ r = Hashcoder .hash (r , getIdentifier ());
113+ r = Hashcoder .hash (r , getVersion ());
99114 return r ;
100- }
115+ }
101116
102117 // public void setDataSource(DataSource dataSource){
103118 // source = dataSource;
104119 // }
105120
121+
122+ /**
123+ * In case if the {@link #getID() } is not unique keeps the id version.
124+ * @return the version
125+ */
126+ public Integer getVersion () {
127+ return version ;
128+ }
129+
130+ public void setVersion (Integer version ) {
131+ this .version = version ;
132+ }
133+
134+ /**
135+ * In case if {@link #getID() } in not unique keeps the alternative id, eg. NCBI GI number.
136+ *
137+ * @return
138+ */
139+ public String getIdentifier () {
140+ return identifier ;
141+ }
142+
143+ public void setIdentifier (String identifier ) {
144+ this .identifier = identifier ;
145+ }
146+
147+
106148 @ Override
107149 public String toString () {
108150 return id ;
0 commit comments