IppPropDouble.java 3.57 KB
/*
 * Decompiled with CFR 0_118.
 */
package com.scene7.is.ipp.messages;

import com.scene7.is.ipp.messages.Ipp;
import com.scene7.is.ipp.messages.IppByte;
import com.scene7.is.ipp.messages.IppDouble;
import com.scene7.is.ipp.messages.IppInt;
import com.scene7.is.ipp.messages.IppProp;
import com.scene7.is.ipp.messages.IppPropId;
import com.scene7.is.ipp.messages.IppPropType;
import com.scene7.is.ipp.messages.Offset;
import java.io.IOException;
import java.io.Writer;

public class IppPropDouble
extends IppProp {
    private int id_;
    private double value_;

    public IppPropDouble(int id, double value) {
        this.id_ = id;
        this.value_ = value;
    }

    public String toString() {
        StringBuffer buffer = new StringBuffer();
        buffer.append("[");
        buffer.append("id: ").append(String.valueOf(this.id_)).append(" ");
        buffer.append("value: ").append(String.valueOf(this.value_)).append(" ");
        buffer.append("]");
        return buffer.toString();
    }

    public boolean equals(Object o) {
        if (!(o instanceof IppPropDouble)) {
            return false;
        }
        IppPropDouble e = (IppPropDouble)o;
        if (this.id_ != e.id_) {
            return false;
        }
        if (this.value_ != e.value_) {
            return false;
        }
        return true;
    }

    public static IppPropDouble UnstuffDerived(byte[] arr, Offset arrayPos) {
        Ipp.Assert((arrayPos.val & 7) == 0, "IppPropDouble align");
        int type = IppInt.Unstuff(arr, arrayPos);
        int id = IppInt.Unstuff(arr, arrayPos);
        double value = IppDouble.Unstuff(arr, arrayPos);
        IppByte.UnstuffFixedArray(arr, arrayPos, 32);
        Ipp.Assert(type == 65538, "IppPropDouble enum id");
        return new IppPropDouble(id, value);
    }

    public static void StuffDerived(byte[] arr, Offset arrayPos, Offset varPos, IppPropDouble val) {
        Ipp.Assert((arrayPos.val & 7) == 0, "IppPropDouble align");
        if (val != null) {
            IppInt.Stuff(arr, arrayPos, varPos, val.type());
            IppInt.Stuff(arr, arrayPos, varPos, val.id());
            IppDouble.Stuff(arr, arrayPos, varPos, val.value());
            Ipp.StuffNullBytes(arr, arrayPos, 32);
        } else {
            Ipp.StuffNullBytes(arr, arrayPos, 48);
        }
    }

    public static void Print(Writer tf, String label, IppPropDouble it) throws IOException {
        String ll = label + "IppPropDouble: ";
        if (it == null) {
            tf.write(ll + "NULL!!\n");
            return;
        }
        tf.write(ll + "\n");
        IppPropType.Print(tf, ll + "type: ", it.type());
        IppPropId.Print(tf, ll + "id: ", it.id());
        IppDouble.Print(tf, ll + "value: ", it.value());
    }

    public static void PrintArray(Writer tf, String label, IppPropDouble[] it) throws IOException {
        String ll = label + "IppPropDouble Array, length: ";
        tf.write(ll);
        if (it == null) {
            tf.write("NULL!!!\n");
            return;
        }
        tf.write("" + it.length + "\n");
        for (int i = 0; i < it.length; ++i) {
            ll = label + "IppPropDouble[" + String.valueOf(i) + "]: ";
            IppPropDouble.Print(tf, ll, it[i]);
        }
    }

    public void adjustVarPos(Offset varPos) {
    }

    public int type() {
        return 65538;
    }

    public int id() {
        return this.id_;
    }

    public double value() {
        return this.value_;
    }

    public String toStringDerived() {
        return String.valueOf(this.value());
    }

    public Object getValue() {
        return new Double(this.value());
    }
}