Changeset 156 for trunk/corelib/src/org/bridgedb/file/IDMapperText.java
- Timestamp:
- 08/14/09 21:50:23 (3 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/corelib/src/org/bridgedb/file/IDMapperText.java
r134 r156 49 49 { 50 50 // parse arguments to determine idsep and dssep 51 // sample: dssep :\t,idsep:;,idsep:,@file:/localfile.txt51 // sample: dssep=\t,idsep=;,idsep=,,transitivity=false@file:/localfile.txt 52 52 // \t represents tab, \@ represents @ 53 53 String path = null; 54 54 char[] dssep = null; 55 55 char[] idsep = null; 56 boolean transitivity = false; 56 57 57 58 int idx = location.indexOf("@"); … … 81 82 82 83 String config = location.substring(0, idx)+","; 84 String prefixTran = "transitivity="; 85 idx = config.indexOf(prefixTran); 86 String tran = config.substring(idx+prefixTran.length()); 87 if (tran.toLowerCase().startsWith("true")) { 88 transitivity = true; 89 } else if (tran.toLowerCase().startsWith("false")) { 90 transitivity = false; 91 } else { 92 throw new IDMapperException( 93 "transivity can only be true or false"); 94 } 95 83 96 dssep = parseConfig(config, "dssep"); 84 97 idsep = parseConfig(config, "idsep"); … … 88 101 try 89 102 { 90 return new IDMapperText(new URL(path), dssep, idsep); 103 return new IDMapperText(new URL(path), dssep, idsep, 104 transitivity); 91 105 } 92 106 catch (MalformedURLException ex) … … 98 112 private char[] parseConfig(String config, String head) { 99 113 Set<Character> delimiters = new HashSet(); 100 Pattern p = Pattern.compile(head+":(.|\\t|\\@),", Pattern.CASE_INSENSITIVE); 114 Pattern p = Pattern.compile(head+"=(.|\\t|\\@),", 115 Pattern.CASE_INSENSITIVE); 101 116 Matcher m = p.matcher(config); 102 117 while (m.find()) {
