I`m trying to understand what my teacher wants from this exercise using the comparable from java.
I`m not sure what I need to do. Someone can give me a head start?
public class BookTag implements Comparable {
private String left;
private int mid;
private String right;
public BookTag(String left, int mid, String right) {
check(left, mid, right);
this.left = left.toUpperCase();
this.mid = mid;
this.right = right.toUpperCase();
}
@Override
public int compareTo(Object arg) {
/*
* Booktags are sorted as follows: - first go booktags with lowest left
* attribute. If left attributes cannot discriminate... - ... first go booktags
* with the lowest mid attribute. If mid cannot discriminate... - ... first go
* booktags with HIGHEST right attribute.
*/
/* COMPLETE */
BookTag tag = (BookTag) arg;
return this.left.compareTo(tag.compareTo(left));
}
}
What king of values I need to compare here?