MCPcopy Create free account
hub / github.com/Whiley/WhileyCompiler / apply

Method apply

src/main/java/wycc/util/testing/TestFile.java:229–244  ·  view source on GitHub ↗
(Map<Trie,TextFile> state)

Source from the content-addressed store, hash-verified

227 }
228
229 public void apply(Map<Trie,TextFile> state) {
230 if (kind == Kind.REMOVE && state.containsKey(filename)) {
231 // Easy case
232 state.remove(filename);
233 } else if (kind == Kind.REMOVE) {
234 throw new IllegalArgumentException("Invalid remove action");
235 } else if(state.containsKey(filename)) {
236 TextFile tf = state.get(filename);
237 state.put(filename, tf.replace(range.start, range.end, lines));
238 } else if(range == null){
239 // Create entirely new file.
240 state.put(filename, new TextFile(lines));
241 } else {
242 throw new IllegalArgumentException("Invalid insert action");
243 }
244 }
245
246 @Override
247 public String toString() {

Callers

nothing calls this directly

Calls 3

replaceMethod · 0.95
removeMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected