@Test public void testAddOrder() { Instant entryTime = clock.instant(); final WorkingOrder order = new WorkingOrder( new TestOrder("ClOrdId1", symbol, Side.Buy, 7, OrdType.Limit, new BigDecimal("12.34")), userId, "Order1", entryTime); orderBook.addOrder(order); WorkingOrder order2 = orderBook.findOrder(order); assertEquals(order2, order); assertNotNull(orderBook.removeOrder(order)); assertNull(orderBook.findOrder(order)); }
public void addOrder(WorkingOrder order) { switch (order.getSide()) { case Buy: bids.add(order); break; case Sell: offers.add(order); break; default: throw new IllegalArgumentException("Invalid side"); } }
OrderBook { public void addOrder(WorkingOrder order) { switch (order.getSide()) { case Buy: bids.add(order); break; case Sell: offers.add(order); break; default: throw new IllegalArgumentException("Invalid side"); } } }
OrderBook { public void addOrder(WorkingOrder order) { switch (order.getSide()) { case Buy: bids.add(order); break; case Sell: offers.add(order); break; default: throw new IllegalArgumentException("Invalid side"); } } OrderBook();  OrderBook(Comparator<WorkingOrder> bidComparator,
      Comparator<WorkingOrder> offerComparator); }
OrderBook { public void addOrder(WorkingOrder order) { switch (order.getSide()) { case Buy: bids.add(order); break; case Sell: offers.add(order); break; default: throw new IllegalArgumentException("Invalid side"); } } OrderBook();  OrderBook(Comparator<WorkingOrder> bidComparator,
      Comparator<WorkingOrder> offerComparator); void addOrder(WorkingOrder order); void clear(); SortedSet<WorkingOrder> findMatches(WorkingOrder order); WorkingOrder findOrder(Side side, String clOrdId, String userId); WorkingOrder findOrder(WorkingOrder order); WorkingOrder removeOrder(Side side, String clOrdId, String userId); WorkingOrder removeOrder(WorkingOrder order); @Override String toString(); }
OrderBook { public void addOrder(WorkingOrder order) { switch (order.getSide()) { case Buy: bids.add(order); break; case Sell: offers.add(order); break; default: throw new IllegalArgumentException("Invalid side"); } } OrderBook();  OrderBook(Comparator<WorkingOrder> bidComparator,
      Comparator<WorkingOrder> offerComparator); void addOrder(WorkingOrder order); void clear(); SortedSet<WorkingOrder> findMatches(WorkingOrder order); WorkingOrder findOrder(Side side, String clOrdId, String userId); WorkingOrder findOrder(WorkingOrder order); WorkingOrder removeOrder(Side side, String clOrdId, String userId); WorkingOrder removeOrder(WorkingOrder order); @Override String toString();  }