package com.gx.obe.evaluation.step.entity;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.gx.obe.web.entity.boq.BillTable;
import com.gx.obe.web.entity.boq.MeasureTable;

/**
 * @Description: 数据缓存
 * @author mazc
 */
public class CacheDataClass {
	
	private int LOCA = 0;
	
	public Map<String, List<BillTable>> BILLTABLE_MAP = new HashMap<String, List<BillTable>>();
	
	public synchronized Map<String, List<BillTable>> getBILLTABLE_MAP() {
		return BILLTABLE_MAP;
	}
	
	public synchronized void setBILLTABLE_MAP(Map<String, List<BillTable>> bILLTABLE_MAP) {
		BILLTABLE_MAP = bILLTABLE_MAP;
	}
	
	public synchronized void setBILLTABLE_MAP(String key, List<BillTable> list) {
		BILLTABLE_MAP.put(key, list);
	}
	
	public static Map<String, List<MeasureTable>> MEASURETBALE_MAP = new HashMap<String, List<MeasureTable>>();
	
	public synchronized Map<String, List<MeasureTable>> getMEASURETBALE_MAP() {
		return MEASURETBALE_MAP;
	}
	
	public synchronized void setMEASURETBALE_MAP(Map<String, List<MeasureTable>> mEASURETBALE_MAP) {
		MEASURETBALE_MAP = mEASURETBALE_MAP;
	}
	
	public synchronized void setMEASURETBALE_MAP(String key, List<MeasureTable> list) {
		MEASURETBALE_MAP.put(key, list);
	}
	
	public static List<String> constructProjectId = new ArrayList<String>();
	
	public synchronized List<String> getConstructProjectId() {
		return constructProjectId;
	}
	
	public synchronized void setConstructProjectId(List<String> constructProjectId) {
		LOCA = 0;
		CacheDataClass.constructProjectId = constructProjectId;
	}
	
	public synchronized List<String> getConstructProjectId(int subNumber) {
		List<String> templist = new ArrayList<String>();
		if (constructProjectId.size() > (LOCA + subNumber)) {
			templist.addAll(constructProjectId.subList(LOCA, LOCA + subNumber));
			LOCA = LOCA + subNumber;
		} else {
			templist.addAll(constructProjectId.subList(LOCA, constructProjectId.size()));
			LOCA = constructProjectId.size();
		}
		return templist;
	}
	
	public static Map<String, List<BillTable>> BILLTABLE_KYE_CONSTRUCT = new HashMap<String, List<BillTable>>();
	
	public synchronized Map<String, List<BillTable>> getBILLTABLE_KYE_CONSTRUCT() {
		return BILLTABLE_KYE_CONSTRUCT;
	}
	
	public synchronized void setBILLTABLE_KYE_CONSTRUCT(Map<String, List<BillTable>> bILLTABLE_KYE_CONSTRUCT) {
		BILLTABLE_KYE_CONSTRUCT = bILLTABLE_KYE_CONSTRUCT;
	}
	
	public synchronized void setBILLTABLE_KYE_CONSTRUCT(String key, List<BillTable> list) {
		BILLTABLE_KYE_CONSTRUCT.put(key, list);
	}
	
	public static Map<String, List<MeasureTable>> MEASURETBALE_KYE_CONSTRUCT = new HashMap<String, List<MeasureTable>>();
	
	public synchronized Map<String, List<MeasureTable>> getMEASURETBALE_KYE_CONSTRUCT() {
		return MEASURETBALE_KYE_CONSTRUCT;
	}
	
	public synchronized void setMEASURETBALE_KYE_CONSTRUCT(Map<String, List<MeasureTable>> mEASURETBALE_KYE_CONSTRUCT) {
		MEASURETBALE_KYE_CONSTRUCT = mEASURETBALE_KYE_CONSTRUCT;
	}
	
	public synchronized void setMEASURETBALE_KYE_CONSTRUCT(String key, List<MeasureTable> list) {
		MEASURETBALE_KYE_CONSTRUCT.put(key, list);
	}
	
	public synchronized static void removeBillTableConstructProjectCacheDataById(String key) {
		BILLTABLE_KYE_CONSTRUCT.remove(key);
		
	}
	
	public synchronized static void removeMeasureTableConstructProjectCacheDataById(String key) {
		MEASURETBALE_KYE_CONSTRUCT.remove(key);
		
	}
	
	public void init() {
		setMEASURETBALE_KYE_CONSTRUCT(new HashMap<String, List<MeasureTable>>());
		setBILLTABLE_KYE_CONSTRUCT(new HashMap<String, List<BillTable>>());
		setMEASURETBALE_MAP(new HashMap<String, List<MeasureTable>>());
		setBILLTABLE_MAP(new HashMap<String, List<BillTable>>());
		LOCA = 0;
	}
	
}
