Changeset 5184 in josm
- Timestamp:
- 2012-04-14T22:46:11+02:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java
r5038 r5184 105 105 @Override 106 106 public Match get(String keyword, PushbackTokenizer tokenizer) throws ParseError { 107 if ("id".equals(keyword)) 108 return new Id(tokenizer); 109 else if ("version".equals(keyword)) 110 return new Version(tokenizer); 111 else if ("changeset".equals(keyword)) 112 return new ChangesetId(tokenizer); 113 else if ("nodes".equals(keyword)) 114 return new NodeCountRange(tokenizer); 115 else if ("tags".equals(keyword)) 116 return new TagCountRange(tokenizer); 117 else if ("areasize".equals(keyword)) 118 return new AreaSize(tokenizer); 119 else if ("modified".equals(keyword)) 107 if ("modified".equals(keyword)) 120 108 return new Modified(); 121 109 else if ("selected".equals(keyword)) … … 137 125 else if ("allinview".equals(keyword)) 138 126 return new InView(true); 139 else if ("timestamp".equals(keyword)) { 140 String rangeS = " " + tokenizer.readTextOrNumber() + " "; // add leading/trailing space in order to get expected split (e.g. "a--" => {"a", ""}) 141 String[] rangeA = rangeS.split("/"); 142 if (rangeA.length == 1) 143 return new KeyValue(keyword, rangeS.trim(), regexSearch, caseSensitive); 144 else if (rangeA.length == 2) { 145 String rangeA1 = rangeA[0].trim(); 146 String rangeA2 = rangeA[1].trim(); 147 long minDate = DateUtils.fromString(rangeA1.isEmpty() ? "1980" : rangeA1).getTime(); // if min timestap is empty: use lowest possible date 148 long maxDate = rangeA2.isEmpty() ? new Date().getTime() : DateUtils.fromString(rangeA2).getTime(); // if max timestamp is empty: use "now" 149 return new TimestampRange(minDate, maxDate); 150 } else 151 /* 152 * I18n: Don't translate timestamp keyword 153 */ throw new ParseError(tr("Expecting <i>min</i>/<i>max</i> after ''timestamp''")); 154 } else 155 return null; 127 else if (tokenizer != null) { 128 if ("id".equals(keyword)) 129 return new Id(tokenizer); 130 else if ("version".equals(keyword)) 131 return new Version(tokenizer); 132 else if ("changeset".equals(keyword)) 133 return new ChangesetId(tokenizer); 134 else if ("nodes".equals(keyword)) 135 return new NodeCountRange(tokenizer); 136 else if ("tags".equals(keyword)) 137 return new TagCountRange(tokenizer); 138 else if ("areasize".equals(keyword)) 139 return new AreaSize(tokenizer); 140 else if ("timestamp".equals(keyword)) { 141 String rangeS = " " + tokenizer.readTextOrNumber() + " "; // add leading/trailing space in order to get expected split (e.g. "a--" => {"a", ""}) 142 String[] rangeA = rangeS.split("/"); 143 if (rangeA.length == 1) 144 return new KeyValue(keyword, rangeS.trim(), regexSearch, caseSensitive); 145 else if (rangeA.length == 2) { 146 String rangeA1 = rangeA[0].trim(); 147 String rangeA2 = rangeA[1].trim(); 148 long minDate = DateUtils.fromString(rangeA1.isEmpty() ? "1980" : rangeA1).getTime(); // if min timestap is empty: use lowest possible date 149 long maxDate = rangeA2.isEmpty() ? new Date().getTime() : DateUtils.fromString(rangeA2).getTime(); // if max timestamp is empty: use "now" 150 return new TimestampRange(minDate, maxDate); 151 } else 152 /* 153 * I18n: Don't translate timestamp keyword 154 */ throw new ParseError(tr("Expecting <i>min</i>/<i>max</i> after ''timestamp''")); 155 } 156 } 157 return null; 156 158 } 157 159
Note:
See TracChangeset
for help on using the changeset viewer.