package com.dev.swms.server.model.rules;

import java.util.Map;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;

import com.dev.energy.server.model.Entity;

public class LotRule extends Entity {
	/** 代码 */
	private String code;
	/** 名称 */
	private String name;
	/** 描述 */
	private String description;
	/** 批次规则 */
	private LotRuleComponent lotRuleComponent;

	public LotRuleComponent getLotRuleComponent() {
		return lotRuleComponent;
	}

	public void setLotRuleComponent(LotRuleComponent lotRuleComponent) {
		this.lotRuleComponent = lotRuleComponent;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Override
	public int hashCode() {
		return new HashCodeBuilder().append(code).toHashCode();
	}

	@Override
	public boolean equals(Object arg0) {
		if (!(arg0 instanceof LotRule))
			return false;
		LotRule castOther = (LotRule) arg0;
		return new EqualsBuilder().append(code, castOther.getCode()).isEquals();
	}
	
	public Map<Integer,Boolean> getLotRuleMap(){
		return lotRuleComponent.getLotRuleMap();
	}
}
