IT-KIMI_SHI\SINOIT.KIMI
2018-06-01 64c40fb427bff513f575f11e4c1e7bd9a1bfe3e3
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package frame.file;
 
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
public class IOMappingRuntime {
      
    private List<IOMappingItemRuntime> MappingRuntimeList;
    private Map<String, IOMappingItemRuntime> fromMap;
    private Map<String, IOMappingItemRuntime> toMap;
      
    public IOMappingRuntime(List<IOMappingItemRuntime> MappingRuntime) {
        MappingRuntimeList = new ArrayList<IOMappingItemRuntime>();
        fromMap = new HashMap<String, IOMappingItemRuntime>();
        toMap = new HashMap<String, IOMappingItemRuntime>();
        
        for (IOMappingItemRuntime ioMappingItemRuntime : MappingRuntime) {
            addItem(ioMappingItemRuntime);
        }
    }
 
    private void addItem(IOMappingItemRuntime ioMappingItemRuntime) {
        // base,add
        fromMap.put(ioMappingItemRuntime.getFromField(), ioMappingItemRuntime);
        toMap.put(ioMappingItemRuntime.getToField(), ioMappingItemRuntime);
    }
    
    public boolean contaisFromField(String fromField) {
        if (fromField == null) {
            return false;
        }
 
        return fromMap.containsKey(fromField.toLowerCase());
    }
    
    public boolean contaisToField(String toField) {
        if (fromField == null) {
            return false;
        }
 
        return fromMap.containsKey(fromField.toLowerCase());
    }
    
    private boolean containsField(String field, String type) {
        if (field == null) {
            return false;
        }
        
        if ("from".equalsIgnoreCase(type)) {
            return fromMap.containsKey(field.toLowerCase());
        }
        else if ("to".equalsIgnoreCase(type)) {
            return toMap.containsKey(field.toLowerCase());
        }
        return false;
    }
}