RandomAccessLoggable =
  (require './RandomAccessLoggable.coffee').RandomAccessLoggable
RandomAccessByteIterable =
  (require './RandomAccessByteIterable.coffee').RandomAccessByteIterable
IllegalStateError =
  (require '../errors/IllegalStateError.coffee').IllegalStateError

# This class is a stub for empty logable. It has only type, no id and data.
class NullLoggable extends RandomAccessLoggable
  @TYPE: 0
  @LENGTH: 1

  # Constructor
  #
  # @param address the addres of this loggable.
  @create$Addr64: (address, o) ->
    if !o? then o = new NullLoggable
    o = RandomAccessLoggable.
    create$Addr64$int$int$RandomAccessByteIterable$int$int(
            address, NullLoggable.TYPE, NullLoggable.LENGTH,
            RandomAccessByteIterable.EMPTY, 0, NullLoggable.NO_STRUCTURE_ID, o)
    return o

  getData: () ->
    throw new IllegalStateError("Can't access NullLoggable.getData()")

  getDataLength: () ->
    throw new IllegalStateError("Can't access NullLoggable.getDataLength()")

  # Create new NullLoggable.
  #
  # @return new NullLoggable.
  @create: () ->
    return NullLoggable.create$Addr64 undefined

  # Check whether loggable is NullLoggable.
  #
  # @param type the type to check.
  # @return true is the loggable or type is NullLoggable and false otherwise.
  @isNullLoggable$int: (type) ->
    return type == NullLoggable.TYPE

  # Check whether loggable is NullLoggable.
  #
  # @param loggable the loggable to check.
  # @return true is the loggable or type is NullLoggable and false otherwise.
  @isNullLoggable$Loggable: (loggable) ->
    return NullLoggable.isNullLoggable$int loggable.getType()

exports.NullLoggable = NullLoggable
