public int compareTo(Object otherTick) { if (!(otherTick instanceof Tick)) { throw new ClassCastException("Not a valid Tick object!"); } Tick tempTick = (Tick) otherTick; if (this.getTimeStamp() > tempTick.getTimeStamp()) { return 1; } else if (this.getTimeStamp() < tempTick.getTimeStamp()) { return -1; } else { return 0; } }
// displays the timeline box and the ticks. public void display() { noStroke(); fill(204); // timeline rect(xpos, ypos, swidth, sheight); if (over || locked) { fill(0, 0, 0); } else { fill(102, 102, 102); } // scrubber // println(spos); rect(spos - sheight / 2, ypos, sheight, sheight); for (int i = 0; i < tickArr.size(); i++) { tickArr.get(i).displayTick(); } prevTick = null; nextTick = null; for (int i = 0; i < tickArr.size(); i++) { if (tickArr.get(i).getXPos() < spos) { prevTick = tickArr.get(i); } else { break; } } for (int i = 0; i < tickArr.size(); i++) { if (tickArr.get(i).getXPos() > spos) { nextTick = tickArr.get(i); break; } } if (prevTick != null) { prevTick.changeCamColorPrev(); } if (nextTick != null) { nextTick.changeCamColorNext(); } }