KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jester > TwoStringSwappingCodeMangler


1 package jester;
2
3 public class TwoStringSwappingCodeMangler extends SimpleCodeMangler {
4     private String JavaDoc originalString, replacementString;
5     
6     public TwoStringSwappingCodeMangler(ClassSourceCodeChanger sourceCodeSystem, String JavaDoc originalString, String JavaDoc replacementString) {
7         super(sourceCodeSystem);
8         this.originalString = originalString;
9         this.replacementString = replacementString;
10     }
11     
12     boolean makeSomeChangeToFileSource() throws SourceChangeException {
13         IgnoreListDocument s = getOriginalContents();
14         int index = s.indexOf(originalString, getIndexOfLastChange() + 1);
15         boolean found = index != -1;
16
17         if (!found) {
18             return false;
19         }
20
21         return makeChange(index, originalString, replacementString);
22     }
23 }
Free Books   Free Magazines  
Popular Tags