private void reloadSceneByIndex(int index) { ITraceElement te = loadNextTraceElement(index); traceElements = featureModel.getAllTraceElements(te.getTraceId()); selectTrace(te.getTraceId()); resetScene(); jumpToEvent(te.getTraceId(), te.getEoi()); }
/** * Removes all trace elements from <code>toTime</code> downto <code>fromTime</code> (excl.). * * @param fromTime * @param fromIndex */ private void removeTraceElementsByTime(long fromTime, int fromIndex) { // updateIndex(UNSELECTED); updateTime(fromTime); for (int removeIndex = fromIndex; removeIndex >= 0; removeIndex--) { ITraceElement te = traceElements.get(removeIndex); if (te.getTin() <= fromTime) { // excl. break; } updateIndex(removeIndex - 1); removeTraceElement(te); } }
/** * Converts the given <code>eoi</code> to the corresponding index of the <code>traceElements * </code> list. * * @param eoi * @return */ private int retrieveIndexForEOI(int eoi) { int index = -1; // TODO improve performance for (int i = 0; i < traceElements.size(); i++) { ITraceElement te = traceElements.get(i); if (te.getEoi() == eoi) { index = i; break; } } if (index < 0) { throw new IllegalArgumentException(); } return index; }
/** * Adds all trace elements from <code>fromTime</code> to <code>toTime</code> (incl.). * * @param fromTime * @param toTime */ private void addTraceElementsByTime(int fromIndex, long toTime) { // key.setTin(fromTime); // int index = Collections.binarySearch(traceElements, key, compaTin); // if (index < 0) { // index = -index - 1; // } // updateIndex(UNSELECTED); updateTime(toTime); for (int i = fromIndex + 1; i < traceElements.size(); i++) { ITraceElement te = traceElements.get(i); if (te.getTin() > toTime) { // incl. break; } updateIndex(i); addTraceElement(te); } }
@Override public void selectTraceElement(long traceId, ITraceElement te) { switch (navStatus) { case GLOBAL: jumpToPointInTime(te.getTin()); break; case LOCAL: if (currentTraceId != traceId) { selectTrace(traceId); resetScene(); } if (te.getTraceId() != traceId) { jumpToEvent(traceId, 0); // jumpToPointInTime(0); } else { jumpToEvent(traceId, te.getEoi()); } break; default: break; } }
@Override public int compare(ITraceElement o1, ITraceElement o2) { return new Long(o1.getTin()).compareTo(o2.getTin()); }