mirror of https://github.com/tasks/tasks
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
615 B
Java
32 lines
615 B
Java
package com.timsu.astrid.data;
|
|
|
|
/** Identifier of a single object. Extend this class to create your own */
|
|
public abstract class Identifier {
|
|
private long id;
|
|
|
|
public Identifier(long id) {
|
|
this.id = id;
|
|
}
|
|
|
|
public long getId() {
|
|
return id;
|
|
}
|
|
|
|
public String idAsString() {
|
|
return Long.toString(id);
|
|
}
|
|
|
|
@Override
|
|
public int hashCode() {
|
|
return (int)id;
|
|
}
|
|
|
|
@Override
|
|
public boolean equals(Object o) {
|
|
if(o == null || o.getClass() != getClass())
|
|
return false;
|
|
|
|
return ((Identifier)o).getId() == getId();
|
|
}
|
|
}
|