private long getCursorJumpPosition( final long refTimestamp )
{
List<Cursor> cursors = new ArrayList<Cursor>( Arrays.asList( getSignalDiagramModel().getDefinedCursors() ) );
Collections.sort( cursors, new CursorComparator() );
Cursor foundCursor = null;
for ( Cursor cursor : cursors )
{
long timestamp = cursor.getTimestamp();
if ( this.direction.isLeft() )
{
if ( timestamp < refTimestamp )
{
foundCursor = cursor;
}
else
{
break;
}
}
else
{
if ( timestamp > refTimestamp )
{
foundCursor = cursor;
break;
}
}
}
if ( foundCursor != null )
{
return foundCursor.getTimestamp();
}
return -1L;
}