ny
昨天 b6f169fe43a2b13f351aefc152374fc7f0bc8cb7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package jnpf.base.util;
 
import jnpf.base.model.datainterface.DataInterfaceMarkModel;
import jnpf.constant.DataInterfaceVarConst;
import jnpf.util.RandomUtil;
 
import java.util.Map;
 
public class DataInterfaceParamUtil {
 
    /**
     * 获取指定字符串所在的位置及应该赋予的值
     *
     * @param map 位置、值
     * @param str 字符串
     * @param specifyString 指定字符串
     * @param value 值
     * @return
     */
    public static Map<Double, DataInterfaceMarkModel> getParamModel(Map<Double, DataInterfaceMarkModel> map, String str, String specifyString, Object value) {
        int frontLength = 0;
        while (str.contains(specifyString)) {
            int index = str.indexOf(specifyString);
            boolean flag = false;
            Double aDouble = Double.valueOf(index + frontLength + 1);
            while (!flag) {
                if (map.containsKey(aDouble)) {
                    aDouble += 0.0001;
                } else {
                    if (specifyString.equals(DataInterfaceVarConst.ID_LOT)) {
                        value = RandomUtil.uuId();
                    }
                    map.put(aDouble, new DataInterfaceMarkModel(specifyString, value));
                    flag = true;
                }
            }
            frontLength += (index + specifyString.length());
            str = str.substring(index + specifyString.length());
        }
        return map;
    }
}