shallowCopy method

TreeElement shallowCopy()

A copy of this element that shares its children and parent.

Implementation

TreeElement shallowCopy() {
  final copy = TreeElement(_name, _multiplicity)
    .._parent = _parent
    ..isRepeatable = isRepeatable
    ..dataType = dataType
    ..constraint = constraint
    ..preloadHandler = preloadHandler
    ..preloadParams = preloadParams
    .._instanceName = _instanceName
    ..namespace = namespace
    .._bindAttributes = _bindAttributes;
  copy
    .._setFlag(_relevantFlag, _flag(_relevantFlag))
    .._setFlag(_requiredFlag, _flag(_requiredFlag))
    .._setFlag(_enabledFlag, _flag(_enabledFlag));
  for (final attribute in _attributes) {
    copy.setAttribute(
      attribute.namespace,
      attribute.name!,
      attribute.attributeValue,
    );
  }
  copy
    .._value = _value
    .._children.addAll(_children);
  return copy;
}