All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.dakusui.lisj.pred.Same Maven / Gradle / Ivy

There is a newer version: 0.8.17
Show newest version
package com.github.dakusui.lisj.pred;


public class Same extends Comp {
	/**
	 * Serial version UID.
	 */
	private static final long serialVersionUID = -7647864958681950805L;

	protected boolean evaluate(Object value, Object another) {
		@SuppressWarnings("rawtypes")
		Comparable lhs = (Comparable) value;
		@SuppressWarnings("rawtypes")
		Comparable rhs = (Comparable) another;
		if (lhs.getClass().isAssignableFrom(rhs.getClass())) {
			return compare(lhs, rhs) == 0;
		}
		if (rhs.getClass().isAssignableFrom(lhs.getClass())) {
			return compare(rhs, lhs) == 0;
		}
		throw new IllegalArgumentException(msgTypeIncompatible(lhs, rhs));
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy