package com.ejie.ab63.util;

/**
 * Common functions, use as impor static
 * 
 *  
 *
 */
public abstract class CommonObjectUtils {

	/**
	 * Check if obj is not null
	 * 
	 * @param obj
	 * @return
	 */
	public static boolean isNotNull(Object obj) {
		return !CommonObjectUtils.isNull(obj);
	}

	/**
	 * Check if obj is nulls
	 * 
	 * @param obj
	 * @return
	 */
	public static boolean isNull(Object obj) {
		return obj == null;
	}

	/**
	 * 
	 * @param value
	 * @param limit
	 * @return
	 */
	public static boolean isGreatherThan(Number value, Number limit) {
		return value.doubleValue() > limit.doubleValue();
	}

	/**
	 * 
	 * @param value
	 * @param limit
	 * @return
	 */
	public static boolean isLowerThan(Number value, Number limit) {
		return value.doubleValue() < limit.doubleValue();
	}

	/**
	 * 
	 * @param value
	 * @param limit
	 * @return
	 */
	public static boolean isEqualsOrGreatherThan(Number value, Number limit) {
		return value.doubleValue() >= limit.doubleValue();
	}

	/**
	 * 
	 * @param value
	 * @param limit
	 * @return
	 */
	public static boolean isEqualsOrLowerThan(Number value, Number limit) {
		return value.doubleValue() <= limit.doubleValue();
	}

	/**
	 * 
	 * @param number
	 * @param number2
	 * @return
	 */
	public static boolean isEquals(Number number, Number number2) {
		return number.doubleValue() == number2.doubleValue();
	}

	/**
	 * 
	 * @param number
	 * @param number2
	 * @return
	 */
	public static boolean isNotEquals(Number number, Number number2) {
		return !isEquals(number, number2);
	}
}
