[Git][java-team/libbeam-java][upstream] New upstream version 1.3.8

Andrius Merkys (@merkys) gitlab at salsa.debian.org
Fri Jan 10 10:21:11 GMT 2025



Andrius Merkys pushed to branch upstream at Debian Java Maintainers / libbeam-java


Commits:
cac9e0c4 by Andrius Merkys at 2025-01-10T04:41:54-05:00
New upstream version 1.3.8
- - - - -


6 changed files:

- core/pom.xml
- core/src/main/java/uk/ac/ebi/beam/GraphBuilder.java
- core/src/main/java/uk/ac/ebi/beam/Topology.java
- exec/pom.xml
- func/pom.xml
- pom.xml


Changes:

=====================================
core/pom.xml
=====================================
@@ -5,7 +5,7 @@
     <parent>
         <artifactId>beam</artifactId>
         <groupId>uk.ac.ebi.beam</groupId>
-        <version>1.3.7</version>
+        <version>1.3.8</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 


=====================================
core/src/main/java/uk/ac/ebi/beam/GraphBuilder.java
=====================================
@@ -32,8 +32,6 @@ package uk.ac.ebi.beam;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.BitSet;
-import java.util.Collections;
-import java.util.Comparator;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
@@ -195,13 +193,25 @@ public final class GraphBuilder {
      * Start building a tetrahedral configuration.
      *
      * @param u the central atom
-     * @return a {@link TetrahedralBuilder} to create the stereo-configuration
+     * @return a {@link AtomStereoBuilder} to create the stereo-configuration
      *         from
      */
     public TetrahedralBuilder tetrahedral(int u) {
         return new TetrahedralBuilder(this, u);
     }
 
+    /**
+     * Start building an atom stereo configuration (tetrahedral/square planar/
+     * octahedral/trigonal bipyramidal).
+     *
+     * @param u the central atom
+     * @return a {@link AtomStereoBuilder} to create the stereo-configuration
+     *         from
+     */
+    public AtomStereoBuilder atomStereo(int u, Configuration configuration) {
+        return new AtomStereoBuilder(this, u).config(configuration);
+    }
+
     /** Start building the geometric configuration of the double bond 'u' / 'v'. */
     public GeometricBuilder geometric(int u, int v) {
         GeometricBuilder builder = new GeometricBuilder(this, u, v);
@@ -231,7 +241,7 @@ public final class GraphBuilder {
     /**
      * (internal) Add a topology to the chemical graph. The topologies should be
      * created using one of the configuration builders (e.g. {@link
-     * TetrahedralBuilder}).
+     * AtomStereoBuilder}).
      *
      * @param t the topology to add
      */
@@ -733,6 +743,119 @@ public final class GraphBuilder {
             return gb;
         }
     }
+
+    /** @author John Mayfield */
+    public static final class AtomStereoBuilder {
+
+        /**
+         * Reference to the graph builder we came from - allows us to add the
+         * topology once the configuration as been built.
+         */
+        final GraphBuilder gb;
+
+        /** Central/Focus vertex. */
+        final int u;
+
+        /** The vertex we are looking from. */
+        int v;
+
+        /** The other neighbors */
+        int[] vs;
+
+        /** The configuration of the other neighbors */
+        Configuration config;
+
+        /**
+         * (internal) - constructor for starting to configure atom stereo.
+         *
+         * @param gb the graph builder (where we came from)
+         * @param u  the vertex to
+         */
+        private AtomStereoBuilder(GraphBuilder gb,
+                                  int u) {
+            this.gb = gb;
+            this.u = u;
+        }
+
+        /**
+         * Indicate from which vertex the atom stereo. is being 'looked-at'.
+         *
+         * @param v the vertex from which we are looking from.
+         * @return tetrahedral builder for further configuration
+         */
+        public AtomStereoBuilder lookingFrom(int v) {
+            this.v = v;
+            return this;
+        }
+
+        /**
+         * Indicate the other neighbors of atom stereo (excluding the vertex we
+         * are looking from). There should be exactly 3 neighbors.
+         *
+         * @param vs the neighbors
+         * @return tetrahedral builder for further configuration
+         * @throws IllegalArgumentException when there was not exactly 3
+         *                                  neighbors
+         */
+        public AtomStereoBuilder neighbors(int[] vs) {
+            this.vs = vs;
+            return this;
+        }
+
+        /**
+         * Indicate the other neighbors of atom stereo (excluding the vertex we
+         * are looking from).
+         *
+         * @param u a neighbor
+         * @param v another neighbor
+         * @param w another neighbor
+         * @return tetrahedral builder for further configuration
+         */
+        public AtomStereoBuilder neighbors(int u, int v, int w) {
+            return neighbors(new int[]{u, v, w});
+        }
+
+        /**
+         * Specify the winding of the {@link #neighbors(int, int, int)}.
+         *
+         * @param c configuration
+         * @return tetrahedral builder for further configuration
+         */
+        public AtomStereoBuilder config(Configuration c) {
+            this.config = c;
+            return this;
+        }
+
+        /**
+         * Finish configuring the atom stereo centre and add it to the graph.
+         *
+         * @return the graph-builder to add more atoms/bonds or stereo elements
+         * @throws IllegalArgumentException configuration was missing
+         */
+        public GraphBuilder build() {
+            if (config == null)
+                throw new IllegalArgumentException("no configuration defined");
+            if (vs == null)
+                throw new IllegalArgumentException("no neighbors defined");
+            Topology t = null;
+            if (config.type() == Configuration.Type.Tetrahedral) {
+                if (vs.length != 3) throw new IllegalArgumentException("incorrect neighbour count");
+                t = Topology.tetrahedral(u, new int[]{v, vs[0], vs[1], vs[2]}, config);
+            } else if (config.type() == Configuration.Type.SquarePlanar) {
+                if (vs.length != 3) throw new IllegalArgumentException("incorrect neighbour count");
+                t = Topology.squarePlanar(u, new int[]{v, vs[0], vs[1], vs[2]}, config);
+            } else if (config.type() == Configuration.Type.TrigonalBipyramidal) {
+                if (vs.length != 4) throw new IllegalArgumentException("incorrect neighbour count");
+                t = Topology.trigonalBipyramidal(u, new int[]{v, vs[0], vs[1], vs[2], vs[3]}, config);
+            } else if (config.type() == Configuration.Type.Octahedral) {
+                if (vs.length != 5) throw new IllegalArgumentException("incorrect neighbour count");
+                t = Topology.octahedral(u, new int[]{v, vs[0], vs[1], vs[2], vs[3], vs[4]}, config);
+            } else
+                throw new IllegalArgumentException("Unimplemented config type: " + config);
+            gb.topology(u, t);
+            return gb;
+        }
+    }
     
     /** @author John May */
     public static final class ExtendedTetrahedralBuilder {


=====================================
core/src/main/java/uk/ac/ebi/beam/Topology.java
=====================================
@@ -270,7 +270,7 @@ abstract class Topology {
         }
     }
 
-    private static Topology trigonalBipyramidal(int u, int[] vs, Configuration c) {
+    static Topology trigonalBipyramidal(int u, int[] vs, Configuration c) {
         if (Configuration.TB1.ordinal() <= c.ordinal() &&
                 Configuration.TB20.ordinal() >= c.ordinal()) {
             int order = 1 + c.ordinal() - Configuration.TB1.ordinal();
@@ -279,7 +279,7 @@ abstract class Topology {
         return null;
     }
 
-    private static Topology octahedral(int u, int[] vs, Configuration c) {
+    static Topology octahedral(int u, int[] vs, Configuration c) {
         if (Configuration.OH1.ordinal() <= c.ordinal() &&
                 Configuration.OH30.ordinal() >= c.ordinal()) {
             int order = 1 + c.ordinal() - Configuration.OH1.ordinal();


=====================================
exec/pom.xml
=====================================
@@ -5,7 +5,7 @@
   <parent>
     <artifactId>beam</artifactId>
     <groupId>uk.ac.ebi.beam</groupId>
-    <version>1.3.7</version>
+    <version>1.3.8</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
 


=====================================
func/pom.xml
=====================================
@@ -5,7 +5,7 @@
     <parent>
         <artifactId>beam</artifactId>
         <groupId>uk.ac.ebi.beam</groupId>
-        <version>1.3.7</version>
+        <version>1.3.8</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 


=====================================
pom.xml
=====================================
@@ -7,7 +7,7 @@
     <description>SMILES parsing and generation library for cheminformatics</description>
     <url>http://www.github.com/johnmay/beam/</url>
     <packaging>pom</packaging>
-    <version>1.3.7</version>
+    <version>1.3.8</version>
     <modules>
         <module>core</module>
         <module>func</module>



View it on GitLab: https://salsa.debian.org/java-team/libbeam-java/-/commit/cac9e0c423bd516321b53fa196f5ec133ba9b61b

-- 
View it on GitLab: https://salsa.debian.org/java-team/libbeam-java/-/commit/cac9e0c423bd516321b53fa196f5ec133ba9b61b
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20250110/a9caf112/attachment.htm>


More information about the pkg-java-commits mailing list