Exemplo n.º 1
0
            /// <summary>
            /// Finish configuring the tetrahedral centre and add it to the graph.
            /// </summary>
            /// <returns>the graph-builder to add more atoms/bonds or stereo elements</returns>
            /// <exception cref="InvalidOperationException">configuration was missing</exception>
            public GraphBuilder Build()
            {
                if (config == null)
                {
                    throw new InvalidOperationException("no configuration defined");
                }
                if (vs == null)
                {
                    throw new InvalidOperationException("no neighbors defined");
                }
                Topology t = Topology.CreateTetrahedral(u,
                                                        new int[] {
                    v,
                    vs[0], vs[1], vs[2]
                },
                                                        config);

                gb.AddTopology(u, t);
                return(gb);
            }
Exemplo n.º 2
0
            /// <summary>
            /// Finish configuring the tetrahedral centre and add it to the graph.
            /// </summary>
            /// <returns>the graph-builder to add more atoms/bonds or stereo elements</returns>
            /// <exception cref="InvalidOperationException">configuration was missing</exception>
            public GraphBuilder Build()
            {
                if (config == null)
                {
                    throw new InvalidOperationException("no configuration defined");
                }
                if (vs == null)
                {
                    throw new InvalidOperationException("no neighbors defined");
                }
                if (gb.g.Degree(u) != 2)
                {
                    throw new InvalidOperationException("extended tetrahedral atom needs exactly 2 neighbors");
                }
                Topology t = Topology.CreateExtendedTetrahedral(u,
                                                                new int[] {
                    v,
                    vs[0], vs[1], vs[2]
                },
                                                                config);

                gb.AddTopology(u, t);
                return(gb);
            }