ABUserPartitionUtils.java
687 Bytes
package com.yoho.search.common.utils;
import org.apache.commons.lang.StringUtils;
public class ABUserPartitionUtils {
public static boolean isAUser(int uid) {
int tail = uid % 1024;
return tail < 512 ? true : false;
}
public static boolean isAUser(String udid) {
if (StringUtils.isBlank(udid)) {
return false;
}
int tail = Math.abs(udid.hashCode() % 1024);
return tail < 512 ? true : false;
}
public static boolean isAUserComplete(int uid,String udid) {
if(uid>0){
return isAUser(uid);
}else{
return isAUser(udid);
}
}
}