|
@@ -1,6 +1,7 @@
|
|
package com.lantone.qc.trans.comsis;
|
|
package com.lantone.qc.trans.comsis;
|
|
|
|
|
|
import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Lists;
|
|
|
|
+import com.google.common.collect.Maps;
|
|
import com.lantone.qc.pub.model.keys.ModelStandardKeys;
|
|
import com.lantone.qc.pub.model.keys.ModelStandardKeys;
|
|
import com.lantone.qc.pub.util.FileUtil;
|
|
import com.lantone.qc.pub.util.FileUtil;
|
|
import com.lantone.qc.pub.util.ListUtil;
|
|
import com.lantone.qc.pub.util.ListUtil;
|
|
@@ -44,13 +45,11 @@ public class Preproc {
|
|
Map<String, String> sections = new HashMap<>();
|
|
Map<String, String> sections = new HashMap<>();
|
|
Map<String, Integer> sorted = new HashMap<>();
|
|
Map<String, Integer> sorted = new HashMap<>();
|
|
|
|
|
|
- String key_ = null;
|
|
|
|
for (String key : title) {
|
|
for (String key : title) {
|
|
Pattern pattern = Pattern.compile(key);
|
|
Pattern pattern = Pattern.compile(key);
|
|
Matcher matcher=pattern.matcher(line);
|
|
Matcher matcher=pattern.matcher(line);
|
|
while(matcher.find()){
|
|
while(matcher.find()){
|
|
key = matcher.group(0);
|
|
key = matcher.group(0);
|
|
- key_ = key.replaceAll("\\s\\p{Zs}","");
|
|
|
|
}
|
|
}
|
|
|
|
|
|
pos = 0;
|
|
pos = 0;
|
|
@@ -60,7 +59,7 @@ public class Preproc {
|
|
if (isProgress) {
|
|
if (isProgress) {
|
|
pos += key.length();
|
|
pos += key.length();
|
|
if (null == sorted.get(key)) {
|
|
if (null == sorted.get(key)) {
|
|
- sorted.put(key_, pos);
|
|
|
|
|
|
+ sorted.put(key, pos);
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
pos_newln = line.substring(0, pos).lastIndexOf(newline);
|
|
pos_newln = line.substring(0, pos).lastIndexOf(newline);
|
|
@@ -69,7 +68,7 @@ public class Preproc {
|
|
|
|
|
|
if (ln_pos == -1 || line.substring(ln_pos + tab.length(), pos).trim().length() == 0) {
|
|
if (ln_pos == -1 || line.substring(ln_pos + tab.length(), pos).trim().length() == 0) {
|
|
pos += key.length();
|
|
pos += key.length();
|
|
- sorted.put(key_, pos);
|
|
|
|
|
|
+ sorted.put(key, pos);
|
|
} else {
|
|
} else {
|
|
pos += 1;
|
|
pos += 1;
|
|
}
|
|
}
|
|
@@ -105,6 +104,11 @@ public class Preproc {
|
|
}
|
|
}
|
|
sections.put(lbl, item);
|
|
sections.put(lbl, item);
|
|
|
|
|
|
|
|
+ Map<String,String> sectionsNew = Maps.newHashMap();
|
|
|
|
+ sections.keySet().forEach(key->{
|
|
|
|
+ sectionsNew.put(key.replaceAll("\\s\\p{Zs}",""),sections.get(key));
|
|
|
|
+ });
|
|
|
|
+
|
|
return sections;
|
|
return sections;
|
|
}
|
|
}
|
|
|
|
|