* Node Modification Node and Tree
*
* Tree which structurally resembles data tree and captures client modifications to the data store tree. This tree is
- * lazily created and populated via {@link #modifyChild(PathArgument)} and {@link TreeNode} which represents original
- * state as tracked by {@link #getOriginal()}.
+ * lazily created and populated via {@link #modifyChild(PathArgument, ModificationApplyOperation, Version)} and
+ * {@link TreeNode} which represents original state as tracked by {@link #getOriginal()}.
*
* The contract is that the state information exposed here preserves the temporal ordering of whatever modifications
* were executed. A child's effects pertain to data node as modified by its ancestors. This means that in order to
*/
@NotThreadSafe
final class ModifiedNode extends NodeModification implements StoreTreeNode<ModifiedNode> {
- static final Predicate<ModifiedNode> IS_TERMINAL_PREDICATE = new Predicate<ModifiedNode>() {
- @Override
- public boolean apply(@Nonnull final ModifiedNode input) {
- Preconditions.checkNotNull(input);
- switch (input.getOperation()) {
+ static final Predicate<ModifiedNode> IS_TERMINAL_PREDICATE = input -> {
+ Preconditions.checkNotNull(input);
+ switch (input.getOperation()) {
case DELETE:
case MERGE:
case WRITE:
case TOUCH:
case NONE:
return false;
- }
-
- throw new IllegalArgumentException(String.format("Unhandled modification type %s", input.getOperation()));
}
+
+ throw new IllegalArgumentException(String.format("Unhandled modification type %s", input.getOperation()));
};
private final Map<PathArgument, ModifiedNode> children;
*/
@Override
public Optional<ModifiedNode> getChild(final PathArgument child) {
- return Optional.<ModifiedNode> fromNullable(children.get(child));
+ return Optional.fromNullable(children.get(child));
}
private Optional<TreeNode> metadataFromSnapshot(@Nonnull final PathArgument child) {
- return original.isPresent() ? original.get().getChild(child) : Optional.<TreeNode>absent();
+ return original.isPresent() ? original.get().getChild(child) : Optional.absent();
}
private Optional<TreeNode> metadataFromData(@Nonnull final PathArgument child, final Version modVersion) {