- ModifiedNode asNewlyWritten(final NormalizedNode<?, ?> value) {
- final ModifiedNode ret = new ModifiedNode(getIdentifier(), Optional.<TreeNode>absent(), false);
- ret.write(value);
- return ret;
+ void updateValue(final LogicalOperation type, final NormalizedNode<?, ?> newValue) {
+ this.value = requireNonNull(newValue);
+ updateOperationType(type);
+ }
+
+ /**
+ * Return the physical modification done to data. May return null if the
+ * operation has not been applied to the underlying tree. This is different
+ * from the logical operation in that it can actually be a no-op if the
+ * operation has no side-effects (like an empty merge on a container).
+ *
+ * @return Modification type.
+ */
+ ModificationType getModificationType() {
+ return modType;
+ }
+
+ public static ModifiedNode createUnmodified(final TreeNode metadataTree, final ChildTrackingPolicy childPolicy) {
+ return new ModifiedNode(metadataTree.getIdentifier(), Optional.of(metadataTree), childPolicy);
+ }
+
+ void setValidatedNode(final SchemaAwareApplyOperation op, final Optional<TreeNode> current, final TreeNode node) {
+ this.validatedOp = requireNonNull(op);
+ this.validatedCurrent = requireNonNull(current);
+ this.validatedNode = requireNonNull(node);