package com.njcn.advance.model.responsibility;

import com.sun.jna.Structure;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;


public class PDataStruct extends Structure implements Serializable {
    public float p[] = new float[QvvrStruct.MAX_P_NODE];

    public PDataStruct() {
    }

    @Override
    protected List getFieldOrder() {
//        return null;
        return Collections.singletonList("p");
    }

    public PDataStruct(double[] p) {
        for (int i = 0; i < p.length; i++) {
            this.p[i] = (float) p[i];
        }
    }

    public static class ByReference extends PDataStruct implements Structure.ByReference {
        public ByReference(double[] p) {
            super(p);
        }
    }

    public static class ByValue extends PDataStruct implements Structure.ByValue {
        public ByValue(double[] p) {
            super(p);
        }
    }

    public float[] getP() {
        return p;
    }

    public void setP(float[] p) {
        this.p = p;
    }

    @Override
    public String toString() {
        return "PDataStruct{" +
                "p=" + Arrays.toString(p) +
                '}';
    }
}
