GraphLinksModel
The generic implementation of a diagram model consisting of nodes and subgraphs, with any number of explicit link data representing links between any two nodes.
Inherits: DiagramModel
Implements: ILinksModel, IDiagramModel, ISubGraphLinksModel, ISubGraphModel, IGroupsModel
Constructors
public GraphLinksModel()
graphLinksModel = GraphLinksModel()
The default constructor produces an empty model.
Properties
public string GroupNodePath { get; set; }
value = graphLinksModel.GroupNodePath
graphLinksModel.GroupNodePath = value
Gets or sets a property path that that specifies how to get the key for "container" or group node data of a node data object.
public string LinkCategoryPath { get; set; }
value = graphLinksModel.LinkCategoryPath
graphLinksModel.LinkCategoryPath = value
Gets or sets a property path that that specifies how to find the category of a link data.
public string LinkFromParameterPath { get; set; }
value = graphLinksModel.LinkFromParameterPath
graphLinksModel.LinkFromParameterPath = value
Gets or sets a property path that that specifies how to get optional "port" parameter information for the "from" node data of a link data object.
public string LinkFromPath { get; set; }
value = graphLinksModel.LinkFromPath
graphLinksModel.LinkFromPath = value
Gets or sets a property path that that specifies how to get the key for the "from" node data of a link data object.
public string LinkLabelNodePath { get; set; }
value = graphLinksModel.LinkLabelNodePath
graphLinksModel.LinkLabelNodePath = value
Gets or sets a property path that that specifies how to get the key for the "label" node data of a link data object.
public IEnumerable LinksSource { get; set; }
value = graphLinksModel.LinksSource
graphLinksModel.LinksSource = value
Gets or sets the collection of link data items for the model.
public string LinkToParameterPath { get; set; }
value = graphLinksModel.LinkToParameterPath
graphLinksModel.LinkToParameterPath = value
Gets or sets a property path that that specifies how to get optional "port" parameter information for the "to" node data of a link data object.
public string LinkToPath { get; set; }
value = graphLinksModel.LinkToPath
graphLinksModel.LinkToPath = value
Gets or sets a property path that that specifies how to get the key for the "to" node data of a link data object.
public string MemberNodesPath { get; set; }
value = graphLinksModel.MemberNodesPath
graphLinksModel.MemberNodesPath = value
Gets or sets a property path that that specifies how to get a list of keys for the "member" nodes of a group node data object.
public string NodeCategoryPath { get; set; }
value = graphLinksModel.NodeCategoryPath
graphLinksModel.NodeCategoryPath = value
Gets or sets a property path that that specifies how to find the category of a node data.
public string NodeIsGroupPath { get; set; }
value = graphLinksModel.NodeIsGroupPath
graphLinksModel.NodeIsGroupPath = value
Gets or sets a property path that that specifies how to find out whether a node data is also a "container" group.
public string NodeIsLinkLabelPath { get; set; }
value = graphLinksModel.NodeIsLinkLabelPath
graphLinksModel.NodeIsLinkLabelPath = value
Gets or sets a property path that that specifies how to find out whether a node data is also a "label" for a link data.
public bool NodeKeyIsNodeData { get; set; }
value = graphLinksModel.NodeKeyIsNodeData
graphLinksModel.NodeKeyIsNodeData = value
Gets or sets whether all node data are also their own keys.
public string NodeKeyPath { get; set; }
value = graphLinksModel.NodeKeyPath
graphLinksModel.NodeKeyPath = value
Gets or sets a property path that that specifies how to get the key for node data.
public bool NodeKeyReferenceAutoInserts { get; set; }
value = graphLinksModel.NodeKeyReferenceAutoInserts
graphLinksModel.NodeKeyReferenceAutoInserts = value
Gets or sets whether a reference, when NodeKeyIsNodeData is true, automatically inserts the node into NodesSource.
public IEnumerable NodesSource { get; set; }
value = graphLinksModel.NodesSource
graphLinksModel.NodesSource = value
Gets or sets the collection of node data items for the model.
public ValidCycle ValidCycle { get; set; }
value = graphLinksModel.ValidCycle
graphLinksModel.ValidCycle = value
Specify what kinds of graphs this model allows.
public ValidUnconnectedLinks ValidUnconnectedLinks { get; set; }
value = graphLinksModel.ValidUnconnectedLinks
graphLinksModel.ValidUnconnectedLinks = value
Gets or sets whether each link data must have both ends refer to node data.
Methods
AddCollectionCopy(GraphLinksModel{, GraphLinksModel{) : CopyDictionary<T, T, T, T>
Copy existing node and link data and add to this model.
- coll
- the collection of data to be copied
- env
- the ICopyDictionary used to keep track of copied objects; if null, the method will call CreateCopyDictionary, use it, and return it
Returns: the updated copy dictionary, mapping original data to copied data
public LinkType AddLink(NodeType fromdata, PortKey fromparam, NodeType todata, PortKey toparam)
result = graphLinksModel.AddLink(fromdata, fromparam, todata, toparam)
Add a link data to LinksSource.
- fromdata
- a node key identifying the node data from which the link comes
- fromparam
- an optional value identifying which port on the "from" node the link is connected to
- todata
- a node key identify the node data to which the link goes
- toparam
- an optional value identifying which port on the "to" node the link is connected to
public void AddLink(LinkType linkdata)
graphLinksModel.AddLink(linkdata)
Add a link data to LinksSource.
- linkdata
public LinkType AddLinkCopy(LinkType linkdata)
result = graphLinksModel.AddLinkCopy(linkdata)
Add a copy of a link data to this model.
- linkdata
Returns: the copied link data
public void AddMemberNodeKey(NodeType nodedata, NodeKey memberkey)
graphLinksModel.AddMemberNodeKey(nodedata, memberkey)
Add a "member" node data's key value to a node data's list of "members".
- nodedata
- the node data to be modified
- memberkey
- the key value of the new "member" node data
public void AddNode(NodeType nodedata)
graphLinksModel.AddNode(nodedata)
Add a node data to NodesSource.
- nodedata
public NodeType AddNodeCopy(NodeType nodedata)
result = graphLinksModel.AddNodeCopy(nodedata)
Add a copy of a node data to this model.
- nodedata
Returns: the copied node data
AugmentCopyCollection(GraphLinksModel{)
Override this method to add more (related) data to be copied.
- coll
- the collection of data to be copied
AugmentCopyDictionary(GraphLinksModel{)
Override this method to avoid copying some data, or to change how copied references are resolved.
- env
- the dictionary mapping original objects to copied objects
protected override void ChangeDataValue(ModelChangedEventArgs e, bool undo)
graphLinksModel.ChangeDataValue(e, undo)
This is called during undo or redo to effect state changes to model data.
- e
- an edit describing the change to be performed
- undo
- true if undoing; false if redoing
protected override void ChangeModelValue(ModelChangedEventArgs e, bool undo)
graphLinksModel.ChangeModelValue(e, undo)
This is called during undo or redo to effect state changes to this model.
- e
- an edit describing the change to be performed
- undo
- true if undoing; false if redoing
protected virtual bool CheckLinkValid(NodeType fromdata, PortKey fromparam, NodeType todata, PortKey toparam, bool ignoreexistinglink, LinkType oldlinkdata)
result = graphLinksModel.CheckLinkValid(fromdata, fromparam, todata, toparam, ignoreexistinglink, oldlinkdata)
This predicate is true if adding a link between two nodes/ports would result in a validly structured graph.
- fromdata
- a node key identifying the node data from which the link comes
- fromparam
- an optional value identifying which port on the "from" node the link is connected to
- todata
- a node key identify the node data to which the link goes
- toparam
- an optional value identifying which port on the "to" node the link is connected to
- ignoreexistinglink
- true if relinking; false if adding a new link
- oldlinkdata
- the original link data that might be modified, if is true
Returns: The behavior of this predicate depends on the value of ValidCycle and ValidUnconnectedLinks.
protected virtual bool CheckMemberValid(NodeType groupnodedata, NodeType membernodedata, bool ignoreexistingmembership)
result = graphLinksModel.CheckMemberValid(groupnodedata, membernodedata, ignoreexistingmembership)
This predicate is true if adding a node to a group node would result in an invalid graph.
- groupnodedata
- the node data that is a group
- membernodedata
- a node data to be considered for adding to the group
- ignoreexistingmembership
- whether to ignore the 's existing group membership, because that member is being transferred out of its existing group
Returns: This returns false for membership that would break the tree structure of the model's graph of groups.
public void ClearUnresolvedReferences()
graphLinksModel.ClearUnresolvedReferences()
Forget all unresolved delayed or forward references.
CopyLink1(T, GraphLinksModel{) : T
This is the first pass of copying link data, responsible for constructing a copy and copying most of its properties.
- linkdata
- env
- the dictionary mapping original objects to copied objects
Returns: the copied link data
CopyLink2(T, GraphLinksModel{, T, T, T, T)
This is the second pass of copying link data, responsible for fixing up references to other objects.
- oldlinkdata
- the original link data
- env
- the dictionary mapping original objects to copied objects
- newlinkdata
- the copied link data
- newfromnodedata
- for convenience, the copied "from" node
- newtonodedata
- for convenience, the copied "to" node
- newlinklabel
- for convenience, the copied "label" node
CopyNode1(T, GraphLinksModel{) : T
This is the first pass of copying node data, responsible for constructing a copy and copying most of its properties.
- nodedata
- env
- the dictionary mapping original objects to copied objects
Returns: the copied node data
CopyNode2(T, GraphLinksModel{, T, T, IEnumerable<T>)
This is the second pass of copying node data, responsible for fixing up references to other objects.
- oldnodedata
- the original node data
- env
- the dictionary mapping original objects to copied objects
- newnodedata
- the copied node data
- newgroup
- for convenience, the copied "parent" node data
- newmembers
- for convenience, a list of newly copied member nodes
public virtual CopyDictionary<NodeType, NodeKey, PortKey, LinkType> CreateCopyDictionary()
result = graphLinksModel.CreateCopyDictionary()
Create an ICopyDictionary initialized for this model.
Returns: Normally this will be an empty dictionary.
public virtual DataCollection<NodeType, NodeKey, PortKey, LinkType> CreateDataCollection()
result = graphLinksModel.CreateDataCollection()
Create an empty IDataCollection for this model.
CreateInitializedCopy(GraphLinksModel{) : GraphLinksModel<T, T, T, T>
Make a copy of this model, without sharing the NodesSource or LinksSource collections.
- init
- This is a DataCollection that provides the initial node and link data. (Such data is not copied.) If this is null, the initial NodesSource and LinksSource values are empty collections.
Returns: a model just like this one, but with different data
protected virtual void DeleteLink(NodeType fromdata, PortKey fromparam, NodeType todata, PortKey toparam)
graphLinksModel.DeleteLink(fromdata, fromparam, todata, toparam)
This method actually implements the removal of a link data from the LinksSource collection.
- fromdata
- a node key identifying the node data from which the link comes
- fromparam
- an optional value identifying which port on the "from" node the link is connected to
- todata
- a node key identify the node data to which the link goes
- toparam
- an optional value identifying which port on the "to" node the link is connected to
protected virtual void DeleteLink(LinkType linkdata)
graphLinksModel.DeleteLink(linkdata)
This method actually implements the removal of a link data from the LinksSource collection.
- linkdata
protected virtual void DeleteMemberNodeKey(NodeType nodedata, NodeKey memberkey)
graphLinksModel.DeleteMemberNodeKey(nodedata, memberkey)
This method actually implements the modification of a node data so that it's collection of children node data does not include a given .
- nodedata
- the node data to be modified; if null, this method does nothing
- memberkey
- the key value of the "member" node data; if null, this method does nothing
protected virtual void DeleteNode(NodeType nodedata)
graphLinksModel.DeleteNode(nodedata)
This method actually implements the removal of a node data from the NodesSource collection.
- nodedata
public void DoGroupNodeChanged(NodeType nodedata)
graphLinksModel.DoGroupNodeChanged(nodedata)
This should be called when a node data's membership in a group may have changed.
- nodedata
- the modified node data
public void DoLinkAdded(LinkType linkdata)
graphLinksModel.DoLinkAdded(linkdata)
This should be called when a link data object is added to the LinksSource collection.
- linkdata
public void DoLinkCategoryChanged(LinkType linkdata)
graphLinksModel.DoLinkCategoryChanged(linkdata)
This should be called when a link data's category value may have changed.
- linkdata
public void DoLinkLabelChanged(LinkType linkdata)
graphLinksModel.DoLinkLabelChanged(linkdata)
This should be called when a link data's label node may have changed.
- linkdata
public void DoLinkPortsChanged(LinkType linkdata)
graphLinksModel.DoLinkPortsChanged(linkdata)
This should be called when a link data's connected node or port, either "from" or "to", may have changed.
- linkdata
public void DoLinkRemoved(LinkType linkdata)
graphLinksModel.DoLinkRemoved(linkdata)
This should be called when a link data object is removed from the LinksSource collection.
- linkdata
public void DoMemberNodeKeyAdded(NodeType nodedata, NodeKey memberkey)
graphLinksModel.DoMemberNodeKeyAdded(nodedata, memberkey)
This should be called when a "member" node data key has been added to the collection of "member" node keys.
- nodedata
- the modified node data
- memberkey
- the key for the added "member" node data
public void DoMemberNodeKeyRemoved(NodeType nodedata, NodeKey memberkey)
graphLinksModel.DoMemberNodeKeyRemoved(nodedata, memberkey)
This should be called when a "member" node data key has been removed from the collection of "member" node keys.
- nodedata
- the modified node data
- memberkey
- the key for the removed "member" node data
public void DoMemberNodeKeysChanged(NodeType nodedata)
graphLinksModel.DoMemberNodeKeysChanged(nodedata)
This should be called when a node data's list of "member" nodes has been replaced.
- nodedata
public void DoNodeAdded(NodeType nodedata)
graphLinksModel.DoNodeAdded(nodedata)
This should be called when a node data object is added to the NodesSource collection.
- nodedata
public void DoNodeCategoryChanged(NodeType nodedata)
graphLinksModel.DoNodeCategoryChanged(nodedata)
This should be called when a node data's category value may have changed.
- nodedata
public void DoNodeKeyChanged(NodeType nodedata)
graphLinksModel.DoNodeKeyChanged(nodedata)
This should be called when a node data's key value may have changed.
- nodedata
public void DoNodeRemoved(NodeType nodedata)
graphLinksModel.DoNodeRemoved(nodedata)
This should be called when a node data object is removed from the NodesSource collection.
- nodedata
protected virtual string FindCategoryForLink(LinkType linkdata)
result = graphLinksModel.FindCategoryForLink(linkdata)
Find the category of a link data.
- linkdata
Returns: by default an empty string
protected virtual string FindCategoryForNode(NodeType nodedata)
result = graphLinksModel.FindCategoryForNode(nodedata)
Find the category of a node data.
- nodedata
Returns: by default an empty string
protected virtual NodeKey FindFromNodeKeyForLink(LinkType linkdata)
result = graphLinksModel.FindFromNodeKeyForLink(linkdata)
Find the "from" node key for a given link data.
- linkdata
Returns: a for the connected node
protected virtual PortKey FindFromParameterForLink(LinkType linkdata)
result = graphLinksModel.FindFromParameterForLink(linkdata)
Find additional information about the "from" node connection for a given link data.
- linkdata
Returns: a
protected virtual NodeKey FindGroupKeyForNode(NodeType nodedata)
result = graphLinksModel.FindGroupKeyForNode(nodedata)
Find containing group node key for a given node data, if any.
- nodedata
Returns: a for the containing group node, or the default value for that type if there is no container node for the node
protected virtual bool FindIsGroupForNode(NodeType nodedata)
result = graphLinksModel.FindIsGroupForNode(nodedata)
Find whether a node data is a group or container of other nodes.
- nodedata
protected virtual bool FindIsLinkLabelForNode(NodeType nodedata)
result = graphLinksModel.FindIsLinkLabelForNode(nodedata)
Find whether a node data is a "label" for a link data.
- nodedata
protected virtual NodeKey FindKeyForNode(NodeType nodedata)
result = graphLinksModel.FindKeyForNode(nodedata)
Find the key for node data.
- nodedata
Returns: the (hopefully) unique key for the given node data in this model
protected virtual NodeKey FindLabelNodeKeyForLink(LinkType linkdata)
result = graphLinksModel.FindLabelNodeKeyForLink(linkdata)
Find the "label" node key for a given link data, if any.
- linkdata
Returns: a for the label node data
protected virtual IEnumerable FindMemberNodeKeysForNode(NodeType nodedata)
result = graphLinksModel.FindMemberNodeKeysForNode(nodedata)
Find the list of keys of the children nodes for a node data object.
- nodedata
Returns: the list of child keys, an IEnumerable of
public NodeType FindNodeByKey(NodeKey key)
result = graphLinksModel.FindNodeByKey(key)
Given a key, find the node data with that key.
- key
- a value of null for this argument will result in the default value for
Returns: a ; the value will be the default for the type if no such node data is known to be in this model
protected virtual NodeKey FindToNodeKeyForLink(LinkType linkdata)
result = graphLinksModel.FindToNodeKeyForLink(linkdata)
Find the "to" node key for a given link data.
- linkdata
Returns: a for the connected node
protected virtual PortKey FindToParameterForLink(LinkType linkdata)
result = graphLinksModel.FindToParameterForLink(linkdata)
Find additional information about the "to" node connection for a given link data.
- linkdata
Returns: a
public string GetCategoryForLink(LinkType linkdata)
result = graphLinksModel.GetCategoryForLink(linkdata)
This method gets the category of a link.
- linkdata
Returns: a String, defaulting to the empty string
public string GetCategoryForNode(NodeType nodedata)
result = graphLinksModel.GetCategoryForNode(nodedata)
This method gets the category of a node.
- nodedata
Returns: a String, defaulting to the empty string
public IEnumerable<NodeType> GetConnectedNodesForNode(NodeType nodedata, Predicate<PortKey> portpred)
result = graphLinksModel.GetConnectedNodesForNode(nodedata, portpred)
Return a sequence of node data that are directly connected to a given node, in either direction.
- nodedata
- portpred
- a predicate to be applied to each port parameter; if non-null, this predicate must be true for the node to be included in the return sequence
Returns: an IEnumerable
public IEnumerable<NodeType> GetConnectedNodesForNode(NodeType nodedata)
result = graphLinksModel.GetConnectedNodesForNode(nodedata)
Return a sequence of node data that are directly connected to a given node, in either direction.
- nodedata
Returns: an IEnumerable
public IEnumerable<LinkType> GetFromLinksForNode(NodeType nodedata)
result = graphLinksModel.GetFromLinksForNode(nodedata)
Return a sequence of link data that are connnected at a given node data, only going into the given node.
- nodedata
Returns: an IEnumerable
public NodeType GetFromNodeForLink(LinkType linkdata)
result = graphLinksModel.GetFromNodeForLink(linkdata)
Return the "from" node data at which a link data is connected.
- linkdata
Returns: a node data
public IEnumerable<NodeType> GetFromNodesForNode(NodeType nodedata)
result = graphLinksModel.GetFromNodesForNode(nodedata)
Return a sequence of node data that are directly connected by links going into a given node.
- nodedata
Returns: an IEnumerable
public IEnumerable<NodeType> GetFromNodesForNode(NodeType nodedata, Predicate<PortKey> toportpred)
result = graphLinksModel.GetFromNodesForNode(nodedata, toportpred)
Return a sequence of node data that are directly connected by links going into a given node.
- nodedata
- toportpred
- a predicate to be applied to each "to" port parameter; if non-null, this predicate must be true for the "from" node to be included in the return sequence
Returns: an IEnumerable
public PortKey GetFromParameterForLink(LinkType linkdata)
result = graphLinksModel.GetFromParameterForLink(linkdata)
Return additional "port" information for the "from" end of a link data.
- linkdata
public NodeType GetGroupForLink(LinkType linkdata)
result = graphLinksModel.GetGroupForLink(linkdata)
Return a container node data for a given link data, if the link belongs to a group.
- linkdata
Returns: a node data
public NodeType GetGroupForNode(NodeType nodedata)
result = graphLinksModel.GetGroupForNode(nodedata)
Return the container group node data for a given node data, if there is one.
- nodedata
Returns: a node data
public bool GetHasLabeledLinkForNode(NodeType nodedata)
result = graphLinksModel.GetHasLabeledLinkForNode(nodedata)
This predicate is true for a node data if it is associated with a link data as its "label".
- nodedata
public bool GetHasLabelNodeForLink(LinkType linkdata)
result = graphLinksModel.GetHasLabelNodeForLink(linkdata)
This predicate is true if the given link data has a "label" node.
- linkdata
public bool GetIsGroupForNode(NodeType nodedata)
result = graphLinksModel.GetIsGroupForNode(nodedata)
This predicate is true if a given node data may be a group (i.e. a container) of other nodes.
- nodedata
public bool GetIsLinkLabelForNode(NodeType nodedata)
result = graphLinksModel.GetIsLinkLabelForNode(nodedata)
This predicate is true if the given node data may be used as a "label" for a link.
- nodedata
public LinkType GetLabeledLinkForNode(NodeType nodedata)
result = graphLinksModel.GetLabeledLinkForNode(nodedata)
Get the link data that refers to a given node data as its "label".
- nodedata
Returns: a link data
public NodeType GetLabelNodeForLink(LinkType linkdata)
result = graphLinksModel.GetLabelNodeForLink(linkdata)
Get the "label" node data for a link data, if any.
- linkdata
Returns: a node data
public IEnumerable<LinkType> GetLinksBetweenNodes(NodeType fromdata, PortKey fromparam, NodeType todata, PortKey toparam)
result = graphLinksModel.GetLinksBetweenNodes(fromdata, fromparam, todata, toparam)
Return a sequence of all link data that go from one node to another, possibly restricted to certain "ports".
- fromdata
- a node key identifying the node data from which the link comes
- fromparam
- an optional value identifying which port on the "from" node the link is connected to
- todata
- a node key identify the node data to which the link goes
- toparam
- an optional value identifying which port on the "to" node the link is connected to
Returns: an IEnumerable
public IEnumerable<LinkType> GetLinksForNode(NodeType nodedata)
result = graphLinksModel.GetLinksForNode(nodedata)
Return a sequence of link data that are connnected at a given node data, in either direction.
- nodedata
Returns: an IEnumerable
public IEnumerable<LinkType> GetLinksForNode(NodeType nodedata, Predicate<LinkType> predicate)
result = graphLinksModel.GetLinksForNode(nodedata, predicate)
Return a sequence of link data that are connnected at a given node data, in either direction, that satisfy a given predicate.
- nodedata
- predicate
- a delegate that takes a as an argument and returns a boolean
Returns: an IEnumerable
public IEnumerable<LinkType> GetMemberLinksForGroup(NodeType nodedata)
result = graphLinksModel.GetMemberLinksForGroup(nodedata)
Return a sequence of link data that are contained by a given node data.
- nodedata
Returns: an IEnumerable of member link data; an empty sequence if there are no member links
public IEnumerable<NodeType> GetMemberNodesForGroup(NodeType nodedata)
result = graphLinksModel.GetMemberNodesForGroup(nodedata)
Return a sequence of node data that are immediate members of a given node data.
- nodedata
Returns: an IEnumerable of member node data; an empty sequence if there are no members
public Type GetNodeType()
result = graphLinksModel.GetNodeType()
Return the .
Returns: a Type, not a node data object, nor a string
public IEnumerable<LinkType> GetToLinksForNode(NodeType nodedata)
result = graphLinksModel.GetToLinksForNode(nodedata)
Return a sequence of link data that are connnected at a given node data, only coming out of the given node.
- nodedata
Returns: an IEnumerable
public NodeType GetToNodeForLink(LinkType linkdata)
result = graphLinksModel.GetToNodeForLink(linkdata)
Return the "to" node data at which a link data is connected.
- linkdata
Returns: a node data
public IEnumerable<NodeType> GetToNodesForNode(NodeType nodedata, Predicate<PortKey> fromportpred)
result = graphLinksModel.GetToNodesForNode(nodedata, fromportpred)
Return a sequence of node data that are directly connected by links coming out from a given node.
- nodedata
- fromportpred
- a predicate to be applied to each "from" port parameter; if non-null, this predicate must be true for the "to" node to be included in the return sequence
Returns: an IEnumerable
public IEnumerable<NodeType> GetToNodesForNode(NodeType nodedata)
result = graphLinksModel.GetToNodesForNode(nodedata)
Return a sequence of node data that are directly connected by links coming out from a given node.
- nodedata
Returns: an IEnumerable
public PortKey GetToParameterForLink(LinkType linkdata)
result = graphLinksModel.GetToParameterForLink(linkdata)
Return additional "port" information for the "to" end of a link data.
- linkdata
protected virtual void HandleLinkPropertyChanged(object sender, PropertyChangedEventArgs e)
graphLinksModel.HandleLinkPropertyChanged(sender, e)
This is the INotifyPropertyChanged event handler for link data.
- sender
- e
- preferably a ModelChangedEventArgs that describes what changed and how
protected virtual void HandleNodePropertyChanged(object sender, PropertyChangedEventArgs e)
graphLinksModel.HandleNodePropertyChanged(sender, e)
This is the INotifyPropertyChanged event handler for node data.
- sender
- e
- preferably a ModelChangedEventArgs that describes what changed and how
protected virtual LinkType InsertLink(NodeType fromdata, PortKey fromparam, NodeType todata, PortKey toparam)
result = graphLinksModel.InsertLink(fromdata, fromparam, todata, toparam)
This method actually implements the creation and addition of a link data to the LinksSource collection.
- fromdata
- a node key identifying the node data from which the link comes
- fromparam
- an optional value identifying which port on the "from" node the link is connected to
- todata
- a node key identify the node data to which the link goes
- toparam
- an optional value identifying which port on the "to" node the link is connected to
protected virtual void InsertLink(LinkType linkdata)
graphLinksModel.InsertLink(linkdata)
This method actually implements the addition of a link data to the LinksSource collection.
- linkdata
protected virtual void InsertMemberNodeKey(NodeType nodedata, NodeKey memberkey)
graphLinksModel.InsertMemberNodeKey(nodedata, memberkey)
This method actually implements the modification of a node data so that it's collection of member node data includes a given .
- nodedata
- the node data to be modified; if null, this method does nothing
- memberkey
- the key value of the new "member" node data; if null, this method does nothing
protected virtual void InsertNode(NodeType nodedata)
graphLinksModel.InsertNode(nodedata)
This method actually implements the addition of a node data to the NodesSource collection.
- nodedata
protected virtual bool IsEqualPortParameters(PortKey a, PortKey b)
result = graphLinksModel.IsEqualPortParameters(a, b)
This predicate compares two values and returns true if they are "equal".
- a
- b
Returns: Normally this uses the default EqualityComparer for the type. But you may need to override this method if that kind of equality comparison is inappropriate for your port information.
public bool IsLinkData(LinkType linkdata)
result = graphLinksModel.IsLinkData(linkdata)
This predicate is true if the argument is a link data in this model.
- linkdata
- the object to be checked to see if it is a known link data in this model
Returns: true if the is in the LinksSource
public bool IsLinked(NodeType fromdata, PortKey fromparam, NodeType todata, PortKey toparam)
result = graphLinksModel.IsLinked(fromdata, fromparam, todata, toparam)
This predicate is true if there is a link from one node data/port to another one.
- fromdata
- a node key identifying the node data from which the link comes
- fromparam
- an optional value identifying which port on the "from" node the link is connected to
- todata
- a node key identify the node data to which the link goes
- toparam
- an optional value identifying which port on the "to" node the link is connected to
public bool IsLinkType(object linkdata)
result = graphLinksModel.IsLinkType(linkdata)
Return the .
Returns: a Type, not a link data object, nor a string
public bool IsLinkValid(NodeType fromdata, PortKey fromparam, NodeType todata, PortKey toparam)
result = graphLinksModel.IsLinkValid(fromdata, fromparam, todata, toparam)
This predicate is true if adding a link between two nodes/ports would result in a valid graph.
- fromdata
- a node key identifying the node data from which the link comes
- fromparam
- an optional value identifying which port on the "from" node the link is connected to
- todata
- a node key identify the node data to which the link goes
- toparam
- an optional value identifying which port on the "to" node the link is connected to
public bool IsMember(NodeType groupnodedata, NodeType membernodedata)
result = graphLinksModel.IsMember(groupnodedata, membernodedata)
This predicate is true if the is a member of the container group.
- groupnodedata
- membernodedata
public bool IsMemberValid(NodeType groupnodedata, NodeType membernodedata, bool ignoreexistingmembership)
result = graphLinksModel.IsMemberValid(groupnodedata, membernodedata, ignoreexistingmembership)
This predicate is true if adding to a group node () would result in an invalid graph.
- groupnodedata
- the node data that is a group
- membernodedata
- a node data
- ignoreexistingmembership
- whether to ignore the 's existing group membership, because that member is being transferred out of its existing group
public bool IsNodeData(NodeType nodedata)
result = graphLinksModel.IsNodeData(nodedata)
This predicate is true if the argument is a node data in this model.
- nodedata
- the object to be checked to see if it is a known node data in this model
Returns: true if the is in the NodesSource
public bool IsNodeType(object nodedata)
result = graphLinksModel.IsNodeType(nodedata)
This predicate is true when the argument is an instance of .
- nodedata
- the arbitrary object to be checked for compatibility to be a node data
Returns: true if the can be cast to the ; false otherwise
public bool IsRelinkValid(NodeType fromdata, PortKey fromparam, NodeType todata, PortKey toparam, LinkType oldlinkdata)
result = graphLinksModel.IsRelinkValid(fromdata, fromparam, todata, toparam, oldlinkdata)
This predicate is true if replacing a link between two nodes/ports would result in a valid graph.
- fromdata
- a node key identifying the node data from which the link comes
- fromparam
- an optional value identifying which port on the "from" node the link is connected to
- todata
- a node key identify the node data to which the link goes
- toparam
- an optional value identifying which port on the "to" node the link is connected to
- oldlinkdata
- the original link data that might be modified
public void Load<NodeDataType, LinkDataType>(XContainer root, XName nodename, XName linkname)
graphLinksModel.Load(root, nodename, linkname)
Given a Linq for XML XContainer holding node and link data, replace this model's NodesSource and LinksSource collections with collections of new node data and new link data.
- root
- the XContainer holding all of the data
- nodename
- the name of each XElement holding node data
- linkname
- the name of each XElement holding link data
public void Load<NodeDataType, LinkDataType>(XContainer root, Func<XElement, NodeDataType> nodedataallocator, Func<XElement, LinkDataType> linkdataallocator)
graphLinksModel.Load(root, nodedataallocator, linkdataallocator)
Given a Linq for XML XContainer holding node and link data, replace this model's NodesSource and LinksSource collections with collections of new node data and new link data.
- root
- the XContainer holding all of the data
- nodedataallocator
- a function that takes an XElement and returns either a newly constructed object of type or null if that XElement is to be ignored
- linkdataallocator
- a function that takes an XElement and returns either a newly constructed object of type or null if that XElement is to be ignored
protected virtual bool MakeNodeKeyUnique(NodeType nodedata)
result = graphLinksModel.MakeNodeKeyUnique(nodedata)
This method is called when a duplicate key has been found.
- nodedata
Returns: true to accept the data as a node after having made the key unique in the model; false to ignore this data.
protected virtual void ModifyGroupNodeKey(NodeType nodedata, NodeKey groupkey)
graphLinksModel.ModifyGroupNodeKey(nodedata, groupkey)
This method actually implements the modification of a node data so that its reference to a containing group node data (if any) is the given .
- nodedata
- the node data to be modified
- groupkey
- the key value of the "group" node data
protected virtual void ModifyLinkFromPort(LinkType linkdata, NodeKey nodekey, PortKey portparam)
graphLinksModel.ModifyLinkFromPort(linkdata, nodekey, portparam)
This method actually implements the modification of a link data to change the reference to the "from" node data and the link's "from" port information.
- linkdata
- the link data to be modified
- nodekey
- the new node data's
- portparam
protected virtual void ModifyLinkLabelKey(LinkType linkdata, NodeKey linklabelkey)
graphLinksModel.ModifyLinkLabelKey(linkdata, linklabelkey)
This method actually implements the modification of a link data to change the reference to the "label" node data.
- linkdata
- the link data to be modified
- linklabelkey
- the new label data's
protected virtual void ModifyLinkToPort(LinkType linkdata, NodeKey nodekey, PortKey portparam)
graphLinksModel.ModifyLinkToPort(linkdata, nodekey, portparam)
This method actually implements the modification of a link data to change the reference to the "to" node data and the link's "to" port information.
- linkdata
- the link data to be modified
- nodekey
- the new node data's
- portparam
protected virtual void ModifyMemberNodeKeys(NodeType nodedata, IEnumerable membernodekeys)
graphLinksModel.ModifyMemberNodeKeys(nodedata, membernodekeys)
This method actually implements the replacement of a group node data's collection of member node keys.
- nodedata
- the node data to be modified
- membernodekeys
- a sequence of "member" node data key values
public void RemoveLink(NodeType fromdata, PortKey fromparam, NodeType todata, PortKey toparam)
graphLinksModel.RemoveLink(fromdata, fromparam, todata, toparam)
Remove all link data from LinksSource that connect the two nodes/ports.
- fromdata
- a node key identifying the node data from which the link comes
- fromparam
- an optional value identifying which port on the "from" node the link is connected to
- todata
- a node key identify the node data to which the link goes
- toparam
- an optional value identifying which port on the "to" node the link is connected to
public void RemoveLink(LinkType linkdata)
graphLinksModel.RemoveLink(linkdata)
Remove a link data from LinksSource.
- linkdata
public void RemoveMemberNodeKey(NodeType nodedata, NodeKey memberkey)
graphLinksModel.RemoveMemberNodeKey(nodedata, memberkey)
Remove a child node data's key value from a group node data's list of "member" key values.
- nodedata
- the node data to be modified
- memberkey
- the key value of the "member" node data
public void RemoveNode(NodeType nodedata)
graphLinksModel.RemoveNode(nodedata)
Remove a node data from NodesSource.
- nodedata
public void ResolveAllReferences()
graphLinksModel.ResolveAllReferences()
Cause ResolveNodeKey( to be called on each known delayed or forward node reference.
protected virtual void ResolveNodeKey(NodeKey nodekey)
graphLinksModel.ResolveNodeKey(nodekey)
This is called repeatedly by ResolveAllReferences, once for each known delayed or forward node reference.
- nodekey
public XElement Save<NodeDataType, LinkDataType>(XName rootname, XName nodename, XName linkname)
result = graphLinksModel.Save(rootname, nodename, linkname)
Generate a Linq for XML XElement holding all of the node and link data.
- rootname
- the name of the returned XElement
- nodename
- the name of each XElement holding node data
- linkname
- the name of each XElement holding link data
Returns: an XElement
public void SetGroupNodeKey(NodeType nodedata, NodeKey groupkey)
graphLinksModel.SetGroupNodeKey(nodedata, groupkey)
Change a node data so that it refers to a different container group node data, by node key.
- nodedata
- the node data to be modified
- groupkey
- the key value of the new "group" node data
public void SetLinkFromPort(LinkType linkdata, NodeKey nodekey, PortKey portparam)
graphLinksModel.SetLinkFromPort(linkdata, nodekey, portparam)
Change a link data so that it refers to a different "from" node data and associated port information.
- linkdata
- the link data to be modified
- nodekey
- the new node data's
- portparam
public void SetLinkLabelKey(LinkType linkdata, NodeKey linklabelkey)
graphLinksModel.SetLinkLabelKey(linkdata, linklabelkey)
Change a link data so that it refers to a different "label" node data.
- linkdata
- the link data to be modified
- linklabelkey
- the new label data's
public void SetLinkToPort(LinkType linkdata, NodeKey nodekey, PortKey portparam)
graphLinksModel.SetLinkToPort(linkdata, nodekey, portparam)
Change a link data so that it refers to a different "to" node data and associated port information.
- linkdata
- the link data to be modified
- nodekey
- the new node data's
- portparam
public void SetMemberNodeKeys(NodeType nodedata, IEnumerable membernodekeys)
graphLinksModel.SetMemberNodeKeys(nodedata, membernodekeys)
Replace a node data's list of "member" key values.
- nodedata
- the node data to be modified
- membernodekeys
- a sequence of "member" node data key values