@Override public NodeState getImmutableNodeState() { return state.snapshot(); }
@Override public NodeState getImmutableNodeState() { return state.snapshot(); }
/** * Creates an immutable snapshot of the given internal state of a * {@link MutableNodeState} instance. * * @param base base state * @param properties current property modifications * @param nodes current child node modifications */ ModifiedNodeState( @NotNull NodeState base, @NotNull Map<String, PropertyState> properties, @NotNull Map<String, MutableNodeState> nodes) { this.base = checkNotNull(base); if (checkNotNull(properties).isEmpty()) { this.properties = emptyMap(); } else { this.properties = newHashMap(properties); } if (checkNotNull(nodes).isEmpty()) { this.nodes = emptyMap(); } else { this.nodes = newHashMap(); for (Entry<String, MutableNodeState> entry : nodes.entrySet()) { this.nodes.put(entry.getKey(), entry.getValue().snapshot()); } } }
/** * Creates an immutable snapshot of the given internal state of a * {@link MutableNodeState} instance. * * @param base base state * @param properties current property modifications * @param nodes current child node modifications */ ModifiedNodeState( @Nonnull NodeState base, @Nonnull Map<String, PropertyState> properties, @Nonnull Map<String, MutableNodeState> nodes) { this.base = checkNotNull(base); if (checkNotNull(properties).isEmpty()) { this.properties = emptyMap(); } else { this.properties = newHashMap(properties); } if (checkNotNull(nodes).isEmpty()) { this.nodes = emptyMap(); } else { this.nodes = newHashMap(); for (Entry<String, MutableNodeState> entry : nodes.entrySet()) { this.nodes.put(entry.getKey(), entry.getValue().snapshot()); } } }