package com.cim.idm.mwmsextend.generic.util;

import java.util.List;

public class StateCheckUtil {

	/*
	* Name : differentCheck
	* Desc : This function is differentCheck
	* Author : ZXY IDM Team
	* Date : 2011.04.17
	*/
	public static <T> int differentCheck(List<T> list){
		
		T oldValue = list.get(0);
		int differentPoint = 0;
		
		for(T value : list){
			
			if(!oldValue.equals(null) && !oldValue.equals(value)){
				return differentPoint;
			}
			oldValue = value;
			differentPoint++;
		}
		
		return 0;
	}
	
	
	/*
	* Name : differentCheck
	* Desc : This function is differentCheck
	* Author : ZXY IDM Team
	* Date : 2011.04.17
	*/
	public static <T> boolean differentCheck(T oldvalue, T newvalue){
		
		if(!oldvalue.equals(null) && !oldvalue.equals(newvalue)){
			return false;
		}else{
			return true;
		}
		
	}
	
	/*
	* Name : AccordCheck
	* Desc : This function is AccordCheck
	* Author : ZXY IDM Team
	* Date : 2011.04.17
	*/
	public static <T> int AccordCheck(List<T> list, T arcordValue){
		
		int differentPoint = 0;
		
		for(T value : list){
			
			if(!arcordValue.equals(value)){
				return differentPoint;
			}
			differentPoint++;
		}
		
		return -1;
	}	
}