【删除】去掉整个OCR包、去掉领域和人的关系代码、去掉搜索中心代码

【修改】更换部分工具类的位置
This commit is contained in:
zer0Black
2023-09-29 15:45:40 +08:00
parent 98fc1cc076
commit 66003cd78b
52 changed files with 24 additions and 4568 deletions
@@ -0,0 +1,50 @@
package com.jero.common.util;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* @Author: liyawei
* @Description:
* @Date: Created in 13:38 2022/2/24
*/
public class LineHumpUtil {
private static Pattern linePattern = Pattern.compile("_(\\w)");
/** 下划线转驼峰 */
public static String lineToHump(String str) {
str = str.toLowerCase();
Matcher matcher = linePattern.matcher(str);
StringBuffer sb = new StringBuffer();
while (matcher.find()) {
matcher.appendReplacement(sb, matcher.group(1).toUpperCase());
}
matcher.appendTail(sb);
return sb.toString();
}
/** 驼峰转下划线(简单写法,效率低于{@link #humpToLine2(String)}) */
public static String humpToLine(String str) {
return str.replaceAll("[A-Z]", "_$0").toLowerCase();
}
private static Pattern humpPattern = Pattern.compile("[A-Z]");
/** 驼峰转下划线,效率比上面高 */
public static String humpToLine2(String str) {
Matcher matcher = humpPattern.matcher(str);
StringBuffer sb = new StringBuffer();
while (matcher.find()) {
matcher.appendReplacement(sb, "_" + matcher.group(0).toLowerCase());
}
matcher.appendTail(sb);
return sb.toString();
}
public static void main(String[] args) {
String lineToHump = lineToHump("f_parent_no_leader");
System.out.println(lineToHump);// fParentNoLeader
System.out.println(humpToLine(lineToHump));// f_parent_no_leader
System.out.println(humpToLine2(lineToHump));// f_parent_no_leader
}
}
@@ -0,0 +1,57 @@
package com.jero.common.util;
import java.awt.*;
import java.util.Random;
/**
* @Author: liyawei
* @Description:
* @Date: Created in 0:09 2022/3/8
*/
public class RandomUtils extends org.apache.commons.lang3.RandomUtils {
private static final char[] codeSeq = new char[]{'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '2', '3', '4', '5', '6', '7', '8', '9'};
private static final char[] numberArray = new char[]{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
private static Random random = new Random();
public RandomUtils() {
}
public static final String randomString(int length) {
StringBuilder sb = new StringBuilder();
for(int i = 0; i < length; ++i) {
sb.append(String.valueOf(codeSeq[random.nextInt(codeSeq.length)]));
}
return sb.toString();
}
public static final String randomNumberString(int length) {
StringBuilder sb = new StringBuilder();
for(int i = 0; i < length; ++i) {
sb.append(String.valueOf(numberArray[random.nextInt(numberArray.length)]));
}
return sb.toString();
}
public static Color randomColor(int fc, int bc) {
int f = fc;
int b = bc;
Random random = new Random();
if (fc > 255) {
f = 255;
}
if (bc > 255) {
b = 255;
}
return new Color(f + random.nextInt(b - f), f + random.nextInt(b - f), f + random.nextInt(b - f));
}
public static int nextInt(int bound) {
return random.nextInt(bound);
}
}
@@ -0,0 +1,38 @@
package com.jero.common.util;
import java.util.Random;
public class UUIDUtils {
public static String randomUUID10() {
return RandomUtils.randomString(10);
}
public static String randomUUID20() {
return RandomUtils.randomString(20);
}
public static String randomUUID(int length) {
return RandomUtils.randomString(length);
}
public static String getUUIDPath(String uuid){
StringBuilder builder=new StringBuilder();
builder.append("/");
builder.append((uuid.substring(0, 3).hashCode())%100+"").append("/");
builder.append((uuid.substring(7,10).hashCode())%100+"").append("/");
builder.append((uuid.substring(11,14).hashCode())%100+"").append("/");
return builder.toString();
}
public static String getAttTable(){
Random rand = new Random();
int nextInt = rand.nextInt(10)+1;
StringBuilder builder=new StringBuilder();
builder.append("ATT_FILE_").append(String.format("%02d", nextInt));
return builder.toString();
}
}