Ejemplo n.º 1
0
class AuctionOrBidWindowCoderImpl(coder_impl.StreamCoderImpl):
  _super_coder_impl = coder_impl.IntervalWindowCoderImpl()
  _id_coder_impl = coder_impl.VarIntCoderImpl()
  _bool_coder_impl = coder_impl.BooleanCoderImpl()

  def encode_to_stream(self, value, stream, nested):
    self._super_coder_impl.encode_to_stream(value, stream, True)
    self._id_coder_impl.encode_to_stream(value.auction, stream, True)
    self._bool_coder_impl.encode_to_stream(
        value.is_auction_window, stream, True)

  def decode_from_stream(self, stream, nested):
    super_window = self._super_coder_impl.decode_from_stream(stream, True)
    auction = self._id_coder_impl.decode_from_stream(stream, True)
    is_auction = self._bool_coder_impl.decode_from_stream(stream, True)
    return AuctionOrBidWindow(
        super_window.start, super_window.end, auction, is_auction)
Ejemplo n.º 2
0
 def _create_impl(self):
     return coder_impl.BooleanCoderImpl()