Ejemplo n.º 1
0
        public void AddJointEdge(construct.Joint joint)
        {
            JointEdge jointEdge = new JointEdge(joint);

            try
            {
                if (piecesVertex.ContainsKey(joint.FirstElement.Id) &&
                    piecesVertex.ContainsKey(joint.SecondElement.Id))
                {
                    jointEdge.PartsVertex.Add(piecesVertex[joint.FirstElement.Id]);
                    jointEdge.PartsVertex.Add(piecesVertex[joint.SecondElement.Id]);

                    piecesVertex[joint.FirstElement.Id].JointsEdge.Add(jointEdge);
                    piecesVertex[joint.SecondElement.Id].JointsEdge.Add(jointEdge);
                }
                else
                {
                    log.Warn(string.Format("The one of requested keys is not in the dictionary of welded parts. Joint #{0}, id:{1}", joint.Number, joint.Id));
                }
            }
            catch (NullReferenceException e)
            {
                log.Error(
                    string.Format("Unable to add the joint #{0}, id:{1} as edge of the pipeline.",
                                  joint.Number, joint.Id));

                throw e;
            }
        }
Ejemplo n.º 2
0
        public void AddJointEdge(construct.Joint joint)
        {
            JointEdge jointEdge = new JointEdge(joint);

            try
            {
                if (piecesVertex.ContainsKey(joint.FirstElement.Id) &&
                    piecesVertex.ContainsKey(joint.SecondElement.Id))
                {
                    jointEdge.PartsVertex.Add(piecesVertex[joint.FirstElement.Id]);
                    jointEdge.PartsVertex.Add(piecesVertex[joint.SecondElement.Id]);

                    piecesVertex[joint.FirstElement.Id].JointsEdge.Add(jointEdge);
                    piecesVertex[joint.SecondElement.Id].JointsEdge.Add(jointEdge);
                }
                else
                {
                    log.Warn(string.Format("The one of requested keys is not in the dictionary of welded parts. Joint #{0}, id:{1}", joint.Number, joint.Id));
                }
            }
            catch(NullReferenceException e)
            {
                log.Error(
                    string.Format("Unable to add the joint #{0}, id:{1} as edge of the pipeline.",
                    joint.Number, joint.Id));

                throw e;
            }
        }
Ejemplo n.º 3
0
        public JointEdge GetCommonJoint(PipelineVertex pipelineVertex)
        {
            JointEdge commonJoint = null;

            foreach (var thisJoint in this.JointsEdge)
            {
                if (commonJoint == null)
                {
                    foreach (var thatJoint in pipelineVertex.JointsEdge)
                    {
                        if (thatJoint == thisJoint)
                        {
                            commonJoint = thisJoint;
                            break;
                        }
                    }
                }
            }

            return(commonJoint);
        }