public bool RemoveNode(IRelationNode node) { if (node == null) { throw new ArgumentNullException(nameof(node)); } return(RemoveNode(node.Discriminant)); }
public IRelationVertex GetVertex(IRelationNode leftNode, IRelationNode rightNode) { if (leftNode == null) { throw new ArgumentNullException(nameof(leftNode)); } if (rightNode == null) { throw new ArgumentNullException(nameof(rightNode)); } return(leftNode.GetVertex(rightNode) ?? rightNode.GetVertex(leftNode)); }
public bool RemoveVertex(IRelationNode leftNode, IRelationNode rightNode) { if (leftNode == null) { throw new ArgumentNullException(nameof(leftNode)); } if (rightNode == null) { throw new ArgumentNullException(nameof(rightNode)); } return(leftNode.Vertices.Remove(rightNode.Discriminant) & rightNode.Vertices.Remove(leftNode.Discriminant)); }
public void AddVertex(IRelationNode leftNode, IRelationNode rightNode, ICardinality leftCardinality = null, ICardinality rightCardinality = null) { if (leftNode == null) { throw new ArgumentNullException(nameof(leftNode)); } if (rightNode == null) { throw new ArgumentNullException(nameof(rightNode)); } if (leftNode.Vertices.ContainsKey(rightNode.Discriminant) || rightNode.Vertices.ContainsKey(leftNode.Discriminant)) { throw new ArgumentException(nameof(leftNode.Discriminant)); } var vertex = new RelationVertex(leftNode, rightNode, leftCardinality, rightCardinality); leftNode.Vertices.Add(rightNode.Discriminant, vertex); rightNode.Vertices.Add(leftNode.Discriminant, vertex); }
public RelationVertex(IRelationNode leftNode, IRelationNode rightNode, ICardinality leftCardinality = null, ICardinality rightCardinality = null) { if (leftNode == null) { throw new ArgumentNullException(nameof(leftNode)); } if (rightNode == null) { throw new ArgumentNullException(nameof(rightNode)); } if (leftNode == RightNode || leftNode.Discriminant == rightNode.Discriminant) { throw new ArgumentException("discriminants should be different"); } LeftNode = leftNode; RightNode = rightNode; LeftCardinality = leftCardinality ?? new Cardinality(); RightCardinality = leftCardinality ?? new Cardinality(); }
public IRelationVertex GetVertex(IRelationNode oppositeNode) { return(GetVertex(oppositeNode.Discriminant)); }