|
@@ -46,9 +46,11 @@ import java.io.*;
|
|
|
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.concurrent.atomic.AtomicInteger;
|
|
import java.util.regex.Matcher;
|
|
import java.util.regex.Matcher;
|
|
import java.util.regex.Pattern;
|
|
import java.util.regex.Pattern;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
+import java.util.stream.IntStream;
|
|
import java.util.stream.Stream;
|
|
import java.util.stream.Stream;
|
|
|
|
|
|
import static java.util.regex.Pattern.*;
|
|
import static java.util.regex.Pattern.*;
|
|
@@ -649,6 +651,52 @@ public class FormulaUtils {
|
|
return coords;
|
|
return coords;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public static String coordsSorted2(String coords){
|
|
|
|
+ if(StringUtils.isNotEmpty(coords)){
|
|
|
|
+ List<String> dataList=Arrays.asList(coords.split(";"));
|
|
|
|
+ if(dataList.size()>2){
|
|
|
|
+ /*判断分区:根据行列长度*/
|
|
|
|
+ List<Integer> row =dataList.stream().map(e->e.split("_")[0]).distinct().map(Integer::parseInt).collect(Collectors.toList());
|
|
|
|
+ List<Integer> column=dataList.stream().map(e->e.split("_")[1]).distinct().map(Integer::parseInt).collect(Collectors.toList());
|
|
|
|
+ if(row.size()>=column.size()){
|
|
|
|
+ /*纵向*/
|
|
|
|
+ if(column.size()>1){
|
|
|
|
+ List<List<Integer>> consecutiveGroups = IntStream.range(0, column.size())
|
|
|
|
+ .boxed()
|
|
|
|
+ .collect(Collectors.collectingAndThen(
|
|
|
|
+ Collectors.groupingBy(
|
|
|
|
+ i -> i - column.get(i),
|
|
|
|
+ LinkedHashMap::new,
|
|
|
|
+ Collectors.mapping(column::get, Collectors.toList())
|
|
|
|
+ ),
|
|
|
|
+ map -> new ArrayList<>(map.values())
|
|
|
|
+ ));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ /* 确定区内方向:*/
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return coords;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+/* public static void main(String[] args) {
|
|
|
|
+ List<Integer> column = Arrays.asList(1, 2, 3, 5, 6, 7, 9, 11, 17);
|
|
|
|
+ List<List<Integer>> consecutiveGroups = IntStream.range(0, column.size())
|
|
|
|
+ .boxed()
|
|
|
|
+ .collect(Collectors.collectingAndThen(
|
|
|
|
+ Collectors.groupingBy(
|
|
|
|
+ i -> i - column.get(i),
|
|
|
|
+ LinkedHashMap::new,
|
|
|
|
+ Collectors.mapping(column::get, Collectors.toList())
|
|
|
|
+ ),
|
|
|
|
+ map -> new ArrayList<>(map.values())
|
|
|
|
+ ));
|
|
|
|
+ AtomicInteger i = new AtomicInteger(column.get(0));
|
|
|
|
+
|
|
|
|
+ List<List<Integer>> consecutiveGroups2= new ArrayList<>(column.stream().collect(Collectors.groupingBy(e -> e - i.getAndSet(e) > 1, LinkedHashMap::new, Collectors.toList())).values());
|
|
|
|
+ System.out.println();
|
|
|
|
+ }*/
|
|
|
|
+
|
|
public static List<Object> slice(List<LocalVariable> local, String formula){
|
|
public static List<Object> slice(List<LocalVariable> local, String formula){
|
|
int min =0;
|
|
int min =0;
|
|
List<Object> result = new ArrayList<>();
|
|
List<Object> result = new ArrayList<>();
|