Move non-libanki methods to the bottom and remove commented code

To make comparison with upstream easier, all methods that don't have an equivalent in sched.py have been moved to the bottom of file. Methods that were commented out have been removed since they are not needed anymore.
Organize constants and remove unused ones.

The parameter passed to deckDueList was never used, so it's safe to remove it.
Organize variable initializations to better match sched.py

Makes it easier to compare with sched.py.
show (end) when exiting with resched=off (dae/anki 71bc925)
fix bug where 2 buttons shown on second learn step (#864) (dae/anki a7b9a7b)
shuffle after importing when random on (#576) (dae/anki 403a53c)

need to order cards after import for sibling spacing (#464) (dae/anki d72fb35)
 leave new cards alone when exporting, so order is preserved (#447) (dae/anki 201b547)
make sure we always show 3 buttons for cards in initial learning (#928) (dae/anki 5ea074e)

even if there's only a single learning step, the easy bonus means we need to
show both buttons
add relative overdueness option (dae/anki 492ed33)
Update sibling/burying behaviour to be in line with anki 2.0.14
Don't use single-object arrays in queues + queue building fixes.

- There is no benefit in storing the result of each row in an array when the result only has one column. Store the values directly in the list for efficiency.
- Don't clear the list until we know we are actually replacing it with new data.
- Explain why we don't reverse the queues like in libanki.
Fix query in totalRevForCurrentDeck()
Fix fuzz interval range calculation for larger intervals.
Fix query for _lrnForDeck()
Sched.java cleanup

- A number of minor changes to variable names, comments, or code layout in order to better match sched.py. Suppressed or resolved some warnings.
- Changed method signatures to match sched.py. It seems we had a custom approach to leech detection which might explain some of the leech bugs we've seen. Leeches will be resolved in a future commit.
- Removed a duplicate loop in the day cutoff check (it did NOT differ from libanki, despite the comment).
add option to disable burying of reviews (dae/anki 9baa3e1)
 do not bump usn/mod when automatically unburying (dae/anki 0a75000)

in the upcoming daily unburying, this could lead to a state
where the remote end unburies just at the start of sync
and clobbers more recent changes made on the local end
strip tags before including on card (#505) (dae/anki cee9b2e)
 run basic integrity check prior to full up  (dae/anki d2535fd)

This commit omits any code in the UI that handles changes in the full sync result.
 catch notes with invalid field count in db check (dae/anki 7ad33fe)