package com.tsi.navi.activity.model;

import com.tsi.navi.dto.CpuControlDTO;

public class CpuControl {
    public static final int MAX_STATUS = 5;

    public boolean isUpdate;
    public boolean status[] = new boolean[MAX_STATUS];
    public boolean unProtected[] = new boolean[MAX_STATUS];

    public CpuControl() {
        init();
    }

    public void init() {
        this.isUpdate = false;
        for (int ii = 0; ii < MAX_STATUS; ii++) {
            this.status[ii] = false;
        }
        for (int ii = 0; ii < MAX_STATUS; ii++) {
            this.unProtected[ii] = false;
        }
    }

    public void updateStatus(CpuControlDTO status) {
        this.isUpdate = false;
        if (this.status[0] != status.e) {
            this.status[0] = status.e;
            this.isUpdate = true;
        }
        if (this.status[1] != status.d) {
            this.status[1] = status.d;
            this.isUpdate = true;
        }
        if (this.status[2] != status.c) {
            this.status[2] = status.c;
            this.isUpdate = true;
        }
        if (this.status[3] != status.b) {
            this.status[3] = status.b;
            this.isUpdate = true;
        }
        if (this.status[4] != status.a) {
            this.status[4] = status.a;
            this.isUpdate = true;
        }
    }
    /*public void updateStatus(int idx, boolean status) {
        if (this.status[idx] != status) {
            this.status[idx] = status;
            this.isUpdate = true;
        }
    }*/
}
