package jxl.write.biff;

import jxl.biff.FormattingRecords;
import jxl.biff.IndexMapping;
import jxl.biff.IntegerHelper;
import jxl.biff.Type;
import jxl.biff.WritableRecordData;
import jxl.biff.XFRecord;

/* JADX INFO: loaded from: classes.dex */
class ColumnInfoRecord extends WritableRecordData {
    private int column;
    private byte[] data;
    private boolean hidden;
    private XFRecord style;
    private int width;
    private int xfIndex;

    public ColumnInfoRecord(int i2, int i3, XFRecord xFRecord) {
        super(Type.COLINFO);
        this.column = i2;
        this.width = i3;
        this.style = xFRecord;
        this.xfIndex = xFRecord.getXFIndex();
        this.hidden = false;
    }

    public void decrementColumn() {
        this.column--;
    }

    public boolean equals(Object obj) {
        if (obj == this) {
            return true;
        }
        if (!(obj instanceof ColumnInfoRecord)) {
            return false;
        }
        ColumnInfoRecord columnInfoRecord = (ColumnInfoRecord) obj;
        if (this.column != columnInfoRecord.column || this.xfIndex != columnInfoRecord.xfIndex || this.width != columnInfoRecord.width || this.hidden != columnInfoRecord.hidden) {
            return false;
        }
        if ((this.style != null || columnInfoRecord.style == null) && (this.style == null || columnInfoRecord.style != null)) {
            return this.style.equals(columnInfoRecord.style);
        }
        return false;
    }

    public XFRecord getCellFormat() {
        return this.style;
    }

    public int getColumn() {
        return this.column;
    }

    @Override // jxl.biff.WritableRecordData
    public byte[] getData() {
        byte[] bArr = new byte[12];
        this.data = bArr;
        IntegerHelper.getTwoBytes(this.column, bArr, 0);
        IntegerHelper.getTwoBytes(this.column, this.data, 2);
        IntegerHelper.getTwoBytes(this.width, this.data, 4);
        IntegerHelper.getTwoBytes(this.xfIndex, this.data, 6);
        IntegerHelper.getTwoBytes(this.hidden ? 7 : 6, this.data, 8);
        return this.data;
    }

    boolean getHidden() {
        return this.hidden;
    }

    int getWidth() {
        return this.width;
    }

    public int getXfIndex() {
        return this.xfIndex;
    }

    public int hashCode() {
        int i2 = ((((((10823 + this.column) * 79) + this.xfIndex) * 79) + this.width) * 79) + (this.hidden ? 1 : 0);
        XFRecord xFRecord = this.style;
        return xFRecord != null ? i2 ^ xFRecord.hashCode() : i2;
    }

    public void incrementColumn() {
        this.column++;
    }

    void rationalize(IndexMapping indexMapping) {
        this.xfIndex = indexMapping.getNewIndex(this.xfIndex);
    }

    public void setCellFormat(XFRecord xFRecord) {
        this.style = xFRecord;
    }

    void setHidden(boolean z) {
        this.hidden = z;
    }

    void setWidth(int i2) {
        this.width = i2;
    }

    public ColumnInfoRecord(ColumnInfoRecord columnInfoRecord) {
        super(Type.COLINFO);
        this.column = columnInfoRecord.column;
        this.width = columnInfoRecord.width;
        this.style = columnInfoRecord.style;
        this.xfIndex = columnInfoRecord.xfIndex;
        this.hidden = columnInfoRecord.hidden;
    }

    public ColumnInfoRecord(jxl.read.biff.ColumnInfoRecord columnInfoRecord, int i2, FormattingRecords formattingRecords) {
        super(Type.COLINFO);
        this.column = i2;
        this.width = columnInfoRecord.getWidth();
        int xFIndex = columnInfoRecord.getXFIndex();
        this.xfIndex = xFIndex;
        this.style = formattingRecords.getXFRecord(xFIndex);
    }

    public ColumnInfoRecord(jxl.read.biff.ColumnInfoRecord columnInfoRecord, int i2) {
        super(Type.COLINFO);
        this.column = i2;
        this.width = columnInfoRecord.getWidth();
        this.xfIndex = columnInfoRecord.getXFIndex();
    }
}
