// Path: src/main/java/kafka/common/ErrorMapping.java
// public abstract class ErrorMapping {
//     public static final ByteBuffer EmptyByteBuffer = ByteBuffer.allocate(0);
// 
//     public static final short UnknownCode = -1;
//     public static final short NoError = 0;
//     public static final short OffsetOutOfRangeCode = 1;
//     public static final short InvalidMessageCode = 2;
//     public static final short UnknownTopicOrPartitionCode = 3;
//     public static final short InvalidFetchSizeCode = 4;
//     public static final short LeaderNotAvailableCode = 5;
//     public static final short NotLeaderForPartitionCode = 6;
//     public static final short RequestTimedOutCode = 7;
//     public static final short BrokerNotAvailableCode = 8;
//     public static final short ReplicaNotAvailableCode = 9;
//     public static final short MessageSizeTooLargeCode = 10;
//     public static final short StaleControllerEpochCode = 11;
//     public static final short OffsetMetadataTooLargeCode = 12;
//     public static final short StaleLeaderEpochCode = 13;
// 
//     private static BiMap<Class<? extends Throwable>, Short> exceptionToCode;
// 
//     static {
//         exceptionToCode.put(OffsetOutOfRangeException.class, OffsetOutOfRangeCode);
//         exceptionToCode.put(InvalidMessageException.class, InvalidMessageCode);
//         exceptionToCode.put(UnknownTopicOrPartitionException.class, UnknownTopicOrPartitionCode);
//         exceptionToCode.put(InvalidMessageSizeException.class, InvalidFetchSizeCode);
//         exceptionToCode.put(NotLeaderForPartitionException.class, NotLeaderForPartitionCode);
//         exceptionToCode.put(LeaderNotAvailableException.class, LeaderNotAvailableCode);
//         exceptionToCode.put(RequestTimedOutException.class, RequestTimedOutCode);
//         exceptionToCode.put(BrokerNotAvailableException.class, BrokerNotAvailableCode);
//         exceptionToCode.put(ReplicaNotAvailableException.class, ReplicaNotAvailableCode);
//         exceptionToCode.put(MessageSizeTooLargeException.class, MessageSizeTooLargeCode);
//         exceptionToCode.put(ControllerMovedException.class, StaleControllerEpochCode);
//         exceptionToCode.put(OffsetMetadataTooLargeException.class, OffsetMetadataTooLargeCode);
//     }
// 
//     public static Short codeFor(Class<? extends Throwable> exception) {
//         return Objects.firstNonNull(exceptionToCode.get(exception), UnknownCode);
//     }
// 
//     public static void maybeThrowException(Short code) {
//         Throwable throwable = exceptionFor(code);
//         if (throwable != null) {
//             throw Throwables.propagate(throwable);
//         }
//     }
// 
//     static Logger logger = LoggerFactory.getLogger(ErrorMapping.class);
// 
//     public static KafkaException exceptionFor(Short code) {
//         Class<? extends Throwable> throwable = exceptionToCode.inverse().get(code);
//         if (throwable == null) return null;
// 
//         try {
//             return (KafkaException) throwable.newInstance();
//         } catch (Exception e) {
//             logger.error("create instance of {} error", throwable, e);
//         }
//         return null;
//     }
// }


import kafka.common.ErrorMapping;
import java.util.List;
package kafka.api;



public class PartitionOffsetsResponse {
    public short error;
    public List<Long> offsets;

    public PartitionOffsetsResponse(short error, List<Long> offsets) {
        this.error = error;
        this.offsets = offsets;
    }

    @Override
    public String toString() {
        return "error: " + ErrorMapping.exceptionFor(error).getClass().getName() + " offsets: " + offsets;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        PartitionOffsetsResponse that = (PartitionOffsetsResponse) o;

        if (error != that.error) return false;
        if (offsets != null ? !offsets.equals(that.offsets) : that.offsets != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = (int) error;
        result = 31 * result + (offsets != null ? offsets.hashCode() : 0);
// Path: src/main/java/kafka/common/ErrorMapping.java
// public abstract class ErrorMapping {
//     public static final ByteBuffer EmptyByteBuffer = ByteBuffer.allocate(0);
// 
//     public static final short UnknownCode = -1;
//     public static final short NoError = 0;
//     public static final short OffsetOutOfRangeCode = 1;
//     public static final short InvalidMessageCode = 2;
//     public static final short UnknownTopicOrPartitionCode = 3;
//     public static final short InvalidFetchSizeCode = 4;
//     public static final short LeaderNotAvailableCode = 5;
//     public static final short NotLeaderForPartitionCode = 6;
//     public static final short RequestTimedOutCode = 7;
//     public static final short BrokerNotAvailableCode = 8;
//     public static final short ReplicaNotAvailableCode = 9;
//     public static final short MessageSizeTooLargeCode = 10;
//     public static final short StaleControllerEpochCode = 11;
//     public static final short OffsetMetadataTooLargeCode = 12;
//     public static final short StaleLeaderEpochCode = 13;
// 
//     private static BiMap<Class<? extends Throwable>, Short> exceptionToCode;
// 
//     static {
//         exceptionToCode.put(OffsetOutOfRangeException.class, OffsetOutOfRangeCode);
//         exceptionToCode.put(InvalidMessageException.class, InvalidMessageCode);
//         exceptionToCode.put(UnknownTopicOrPartitionException.class, UnknownTopicOrPartitionCode);
//         exceptionToCode.put(InvalidMessageSizeException.class, InvalidFetchSizeCode);
//         exceptionToCode.put(NotLeaderForPartitionException.class, NotLeaderForPartitionCode);
//         exceptionToCode.put(LeaderNotAvailableException.class, LeaderNotAvailableCode);
//         exceptionToCode.put(RequestTimedOutException.class, RequestTimedOutCode);
//         exceptionToCode.put(BrokerNotAvailableException.class, BrokerNotAvailableCode);
//         exceptionToCode.put(ReplicaNotAvailableException.class, ReplicaNotAvailableCode);
//         exceptionToCode.put(MessageSizeTooLargeException.class, MessageSizeTooLargeCode);
//         exceptionToCode.put(ControllerMovedException.class, StaleControllerEpochCode);
//         exceptionToCode.put(OffsetMetadataTooLargeException.class, OffsetMetadataTooLargeCode);
//     }
// 
//     public static Short codeFor(Class<? extends Throwable> exception) {
//         return Objects.firstNonNull(exceptionToCode.get(exception), UnknownCode);
//     }
// 
//     public static void maybeThrowException(Short code) {
//         Throwable throwable = exceptionFor(code);
//         if (throwable != null) {
//             throw Throwables.propagate(throwable);
//         }
//     }
// 
//     static Logger logger = LoggerFactory.getLogger(ErrorMapping.class);
// 
//     public static KafkaException exceptionFor(Short code) {
//         Class<? extends Throwable> throwable = exceptionToCode.inverse().get(code);
//         if (throwable == null) return null;
// 
//         try {
//             return (KafkaException) throwable.newInstance();
//         } catch (Exception e) {
//             logger.error("create instance of {} error", throwable, e);
//         }
//         return null;
//     }
// }


// Path: src/main/java/kafka/api/PartitionOffsetsResponse.java
import kafka.common.ErrorMapping;
import java.util.List;

package kafka.api;



public class PartitionOffsetsResponse {
    public short error;
    public List<Long> offsets;

    public PartitionOffsetsResponse(short error, List<Long> offsets) {
        this.error = error;
        this.offsets = offsets;
    }

    @Override
    public String toString() {
        return "error: " + ErrorMapping.exceptionFor(error).getClass().getName() + " offsets: " + offsets;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        PartitionOffsetsResponse that = (PartitionOffsetsResponse) o;

        if (error != that.error) return false;
        if (offsets != null ? !offsets.equals(that.offsets) : that.offsets != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = (int) error;
        result = 31 * result + (offsets != null ? offsets.hashCode() : 0);
        return result;