package com.gic.haoban.manage.web.vo;

import com.alibaba.fastjson.JSON;

public class ClerkEditInfoVO {

    private int editClerkFlag ;  // 1
    private int addClerkFlag ;   // 2
    private int delClerkFlag ;   // 4
    public int getEditClerkFlag() {
        return editClerkFlag;
    }
    public int getAddClerkFlag() {
        return addClerkFlag;
    }
    public int getDelClerkFlag() {
        return delClerkFlag;
    }
    public void setEditClerkFlag(int editClerkFlag) {
        this.editClerkFlag = editClerkFlag;
    }
    public void setAddClerkFlag(int addClerkFlag) {
        this.addClerkFlag = addClerkFlag;
    }
    public void setDelClerkFlag(int delClerkFlag) {
        this.delClerkFlag = delClerkFlag;
    }
    
    public static ClerkEditInfoVO info(int v) {
        ClerkEditInfoVO vo = new ClerkEditInfoVO();
        vo.setEditClerkFlag(v & 1);
        vo.setAddClerkFlag((v & 2) >> 1);
        vo.setDelClerkFlag((v & 4) >> 2);
        return vo ;
    }
    
    public static int getValue(ClerkEditInfoVO vo) {
        int editClerkFlag = vo.getEditClerkFlag() ;
        int addClerkFlag = vo.getAddClerkFlag() << 1;
        int delClerkFlag = vo.getDelClerkFlag() << 2;
        return editClerkFlag | addClerkFlag | delClerkFlag ;
    }
    
    
    public static void main(String[] args) {
        ClerkEditInfoVO vo = new ClerkEditInfoVO();
        vo.setAddClerkFlag(1);
        vo.setDelClerkFlag(0);
        vo.setEditClerkFlag(0);
        System.out.println(getValue(vo));
        
        System.out.println(JSON.toJSONString(info(getValue(vo))));
        
    }
}
