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

com.scudata.dm.comparator.DescComparator Maven / Gradle / Ivy

Go to download

SPL(Structured Process Language) A programming language specially for structured data computing.

There is a newer version: 20241126
Show newest version
package com.scudata.dm.comparator;

import java.util.Comparator;

import com.scudata.common.ICloneable;

/**
 * ????????Ƚ???
 * @author WangXiaoJun
 *
 */
public class DescComparator implements Comparator, ICloneable {
	private Comparator comparator;

	public DescComparator(Comparator comparator) {
		this.comparator = comparator;
	}

	public DescComparator() {
		this.comparator = new BaseComparator();
	}
	
	public Object deepClone() {
		if (comparator instanceof ICloneable) {
			return new DescComparator((Comparator)((ICloneable)comparator).deepClone());
		} else {
			return new DescComparator(comparator);
		}
	}

	public int compare(Object o1, Object o2) {
		return comparator.compare(o2, o1);
	}
}