private static String toString()

in simulator/src/main/java/com/google/cloud/StandardOutputConsumer.java [42:98]


  private static String toString(OrderBookEvent obe) {

    // Last message for all messages
    if (obe.getLastMessage()) {
      return String.format("GSEQ:%d LAST GLOBAL MESSAGE",
        obe.getSeqId()
      );
    }

    // Last message for contract
    if (obe.getLastContractMessage()) {
      return String.format("GSEQ:%d CONTRACT:%d CSEQ:%d LAST CONTRACT MESSAGE",
        obe.getSeqId(),
        obe.getContractId(),
        obe.getContractSeqId()
      );
    }

    switch (obe.getType()) {
      case NEW: {
        return String.format("GSEQ:%d CONTRACT:%d CSEQ:%d NEW [%d] %s %d @ %d",
            obe.getSeqId(),
            obe.getContractId(),
            obe.getContractSeqId(),
            obe.getOrderId(),
            obe.getSide(),
            obe.getQuantityRemaining(),
            obe.getPrice()
        );
      }
      case EXECUTED: {
        return String.format("GSEQ:%d CONTRACT:%d CSEQ:%d EXE [%d] %s %d @ %d",
            obe.getSeqId(),
            obe.getContractId(),
            obe.getContractSeqId(),
            obe.getOrderId(),
            obe.getSide(),
            obe.getQuantityFilled(),
            obe.getPrice()
        );
      }
      case DELETED: {
        return String.format("GSEQ:%d CONTRACT:%d CSEQ:%d CAN [%d] %s %d @ %d",
            obe.getSeqId(),
            obe.getContractId(),
            obe.getContractSeqId(),
            obe.getOrderId(),
            obe.getSide(),
            obe.getQuantityRemaining(),
            obe.getPrice()
        );
      }
      default: {
        return "BROKEN";
      }
    }
  }