package com.tsi.comm.server.vo;

import lombok.Data;

@Data
public class TsiNodeAddDetailVo {
    public static int MAX_NODE_ADD = 10;
    private long nodeId;
    private int  originDirCode;
    private int  addNodeOrder;
    private byte[] addDirCode;// = new byte[MAX_NODE_ADD];
    private TsiNodeVo nodeObj;

    public void setAddDirCode(String addDirCode) {
        //Arrays.fill(this.addDirCode, (byte) 0x00);
        try {
            String[] arrAddDirCode = addDirCode.split(",");
            int addDirCount = arrAddDirCode.length;
            if (addDirCount > 0) {
                this.addDirCode = new byte[addDirCount];
                for (int ii = 0; ii < arrAddDirCode.length; ii++) {
                    this.addDirCode[ii] = (byte) Integer.parseInt(arrAddDirCode[ii].trim());
                }
            }
            else {
                this.addDirCode = null;
            }
        }
        catch (Exception e) {
            this.addDirCode = null;
        }

//        this.addDirCode[0] = 0x00;
//        this.addDirCode[1] = 0x00;
//        try {
//            String[] arrAddDirCode = addDirCode.split(",");
//            if (arrAddDirCode.length >= 1) {
//                this.addDirCode[0] = (byte) Integer.parseInt(arrAddDirCode[0]);
//            }
//            if (arrAddDirCode.length >= 2) {
//                this.addDirCode[1] = (byte) Integer.parseInt(arrAddDirCode[1]);
//            }
//        } catch (Exception e) {
//        }
    }
}
