public void LinkParent(ILinkedTreeElement parent) { if (this.parent != null) { this.parent = parent; } else { throw new InvalidOperationException("Parent already set"); } }
public void LinkChild(ILinkedTreeElement child) { if (!targetResources.Contains(child)) { targetResources.Add((TargetResource)child); } else { throw new ArgumentException("already exists", "child"); } }
public void UnlinkChild(ILinkedTreeElement child) { if (targetResources.Contains(child)) { targetResources.Remove((TargetResource)child); } else { throw new ArgumentException("Not found", "child"); } throw new NotImplementedException(); }
public ILinkedTreeElement UnlinkParent() { if (parent != null) { var p = parent; parent = null; return p; } else { throw new InvalidOperationException("Parent is not null"); } }