Changeset 130 for trunk/src/org/expeditee/simple
- Timestamp:
- 07/10/08 11:01:16 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/simple/Context.java
r121 r130 212 212 } 213 213 214 public boolean isNull(String varName) { 215 try { 216 Object o = null; 217 if (Primitives.isPrimitive(varName)) { 218 SPrimitive sp = getPrimitives().getVariable(varName); 219 if(sp == null) 220 o = sp; 221 else 222 o = sp.getValue(); 223 } else { 224 o = getPointers().getVariable(varName); 225 } 226 return o == null; 227 } catch (Exception e) { 228 return false; 229 } 230 } 231 214 232 public boolean isDefined(String varName) { 215 233 try { … … 244 262 245 263 } 264 265 public boolean searchItem(Text itemToSearch, String pattern, 266 String itemVar, String startVar, String endVar, 267 String replacementString) throws Exception { 268 String searchStr = itemToSearch.getText(); 269 String[] result = searchStr.split(pattern, 2); 270 boolean bFound = result.length > 1; 271 if (bFound) { 272 if (itemVar != null) 273 getPointers().setObject(itemVar, itemToSearch); 274 if (startVar != null) { 275 getPrimitives().setValue(startVar, 276 new SInteger(result[0].length() + 1)); 277 assert (endVar != null); 278 getPrimitives().setValue(endVar, 279 new SInteger(searchStr.length() - result[1].length())); 280 } 281 // If it is a find and replace... then replace with the replacement 282 // string 283 if (replacementString != null) { 284 itemToSearch.setText(searchStr.replaceAll(pattern, 285 replacementString)); 286 } 287 } 288 return bFound; 289 } 246 290 }
Note:
See TracChangeset
for help on using the changeset viewer.