Skip to content

Commit

Permalink
Switch to method versions here.
Browse files Browse the repository at this point in the history
  • Loading branch information
EnderTurret committed Oct 7, 2022
1 parent 41e8b85 commit 8b88f37
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/main/java/net/enderturret/patched/patch/PatchUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -244,33 +244,33 @@ public static record AddOperation(JsonElement elem, boolean replace) implements

@Override
public ElementContext apply(JsonObject obj, String name) {
obj.add(name, elem);
return new ElementContext.Object(obj, name, elem);
obj.add(name, elem());
return new ElementContext.Object(obj, name, elem());
}

@Override
public ElementContext apply(JsonArray arr, int idx) {
if (replace)
arr.set(idx, elem);
if (replace())
arr.set(idx, elem());
else
add(arr, idx, elem);
add(arr, idx, elem());

return new ElementContext.Array(arr, idx, elem);
return new ElementContext.Array(arr, idx, elem());
}

@Override
public boolean allowsEndOfArrayRef() {
return !replace;
return !replace();
}

@Override
public boolean allowsOutOfBounds() {
return !replace;
return !replace();
}

@Override
public boolean strictHas() {
return replace;
return replace();
}
}
}

0 comments on commit 8b88f37

Please sign in to comment.