|
|
|
|
@ -1,6 +1,5 @@
|
|
|
|
|
package cn.edu.hust.session;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import scala.math.Ordered;
|
|
|
|
|
|
|
|
|
|
public class CategorySortKey implements Ordered<CategorySortKey>, java.io.Serializable {
|
|
|
|
|
@ -26,21 +25,26 @@ public class CategorySortKey implements Ordered<CategorySortKey>, java.io.Serial
|
|
|
|
|
return (int) (payCount-categorySortKey.getPayCount());
|
|
|
|
|
return 0;// 如果点击数、订单数和支付数都相等,则返回 0,表示相等
|
|
|
|
|
}
|
|
|
|
|
//11
|
|
|
|
|
@Override
|
|
|
|
|
public boolean $less(CategorySortKey categorySortKey) {
|
|
|
|
|
if(clickCount<categorySortKey.getClickCount())
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}else if(clickCount==categorySortKey.getClickCount()&&orderCount<categorySortKey.getOrderCount())
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
// 首先,比较点击数。如果当前对象的点击数小于传入对象的点击数,则当前对象"小于"传入对象
|
|
|
|
|
if (clickCount < categorySortKey.getClickCount()) {
|
|
|
|
|
return true; // 返回true,表示当前对象小于传入对象
|
|
|
|
|
}
|
|
|
|
|
else if(clickCount==categorySortKey.getClickCount()&&orderCount==categorySortKey.getOrderCount()&&payCount<categorySortKey.getPayCount())
|
|
|
|
|
return true;
|
|
|
|
|
// 如果点击数相等,则比较订单数。如果当前对象的订单数小于传入对象的订单数,则当前对象"小于"传入对象
|
|
|
|
|
else if (clickCount == categorySortKey.getClickCount() && orderCount < categorySortKey.getOrderCount()) {
|
|
|
|
|
return true; // 返回true,表示当前对象小于传入对象
|
|
|
|
|
}
|
|
|
|
|
// 如果点击数和订单数都相等,则比较支付数。如果当前对象的支付数小于传入对象的支付数,则当前对象"小于"传入对象
|
|
|
|
|
else if (clickCount == categorySortKey.getClickCount() && orderCount == categorySortKey.getOrderCount() && payCount < categorySortKey.getPayCount()) {
|
|
|
|
|
return true; // 返回true,表示当前对象小于传入对象
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 如果上述条件都不满足,则说明当前对象不小于传入对象,返回false
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean $greater(CategorySortKey categorySortKey) {
|
|
|
|
|
if(clickCount>categorySortKey.getClickCount())
|
|
|
|
|
|