timmolter/XChange — pull request #582 by rafalkrupinski (2014-08-06 18:29:52+00:00)
Title: Remove sorting of orders from OrderBook

This patch removes sorting of orders or replaces it with injection at the right index.

Update methods use Collections.binarySearch to find the right index.
Newly created OrderBooks rely on the drivers to sort the orders, only two exchanges require reverting the ordering of asks.

I also added getOrders(OrderType) that returns either asks or bids depending on the parameter.

Remarks:
- OrderBook.update(OrderBookUpdate) removes order if the OrderBookUpdate.totalVolume == ZERO but update(LimitOrder) doesn't. Shouldn't they behave consistently? Just asking.
- I've added static withAmount() that copies a LimitOrder changing tradableAmount (the prototype pattern). Not sure if it should stay in OrderBook or should I move it to LimitOrder or Order