-public class NodeModification implements StoreTreeNode<NodeModification>, Identifiable<PathArgument> {
-
- public static final Predicate<NodeModification> IS_TERMINAL_PREDICATE = new Predicate<NodeModification>() {
- @Override
- public boolean apply(final NodeModification input) {
- return input.getModificationType() == ModificationType.WRITE //
- || input.getModificationType() == ModificationType.DELETE //
- || input.getModificationType() == ModificationType.MERGE;
- }
- };
- private final PathArgument identifier;
- private ModificationType modificationType = ModificationType.UNMODIFIED;
-
-
- private final Optional<StoreMetadataNode> original;
-
- private NormalizedNode<?, ?> value;
-
- private Optional<StoreMetadataNode> snapshotCache;
-
- private final Map<PathArgument, NodeModification> childModification;
-
- @GuardedBy("this")
- private boolean sealed = false;
-
- protected NodeModification(final PathArgument identifier, final Optional<StoreMetadataNode> original) {
- this.identifier = identifier;
- this.original = original;
- childModification = new LinkedHashMap<>();
- }
-
- /**
- *
- *
- * @return
- */
- public NormalizedNode<?, ?> getWritenValue() {
- return value;
- }
-
- @Override
- public PathArgument getIdentifier() {
- return identifier;
- }
-
- /**
- *
- * Returns original store metadata
- * @return original store metadata
- */
- public final Optional<StoreMetadataNode> getOriginal() {
- return original;
- }
-
- /**
- * Returns modification type
- *
- * @return modification type
- */
- public final ModificationType getModificationType() {
- return modificationType;
- }
-
- /**
- *
- * Returns child modification if child was modified
- *
- * @return Child modification if direct child or it's subtree
- * was modified.
- *
- */
- @Override
- public Optional<NodeModification> getChild(final PathArgument child) {
- return Optional.<NodeModification> fromNullable(childModification.get(child));
- }
-