Skip to content

Commit

Permalink
getBegin() rather than getBeg()
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmay committed May 2, 2017
1 parent a2ee980 commit 1c315b6
Show file tree
Hide file tree
Showing 159 changed files with 548 additions and 570 deletions.
Expand Up @@ -208,7 +208,7 @@ private static Set<IBond> findCutBonds(IAtomContainer mol, EdgeToBondMap bmap, i
private static List<IAtomContainer> makeCut(IBond cut, IAtomContainer mol, Map<IAtom, Integer> idx,
int[][] adjlist) {

IAtom beg = cut.getBeg();
IAtom beg = cut.getBegin();
IAtom end = cut.getEnd();

Set<IAtom> bvisit = new LinkedHashSet<>();
Expand Down Expand Up @@ -272,7 +272,7 @@ else if (diff > 10)
}

for (IBond bond : mol.bonds()) {
IAtom a1 = bond.getBeg();
IAtom a1 = bond.getBegin();
IAtom a2 = bond.getEnd();
if (bvisit.contains(a1) && bvisit.contains(a2))
bfrag.addBond(bond);
Expand Down Expand Up @@ -447,10 +447,10 @@ public List<Sgroup> generate(final IAtomContainer mol) {
IAtom atom = frag.getAtom(i);
usedAtoms.add(atom);
sgroup.addAtom(atom);
if (attachBond.getBeg() == atom)
if (attachBond.getBegin() == atom)
attachAtom = attachBond.getEnd();
else if (attachBond.getEnd() == atom)
attachAtom = attachBond.getBeg();
attachAtom = attachBond.getBegin();
}

if (attachAtom != null)
Expand Down Expand Up @@ -717,7 +717,7 @@ private IQueryAtomContainer matchExact(IAtomContainer mol) {
}

for (IBond bond : mol.bonds()) {
final IAtom beg = atmmap.get(bond.getBeg());
final IAtom beg = atmmap.get(bond.getBegin());
final IAtom end = atmmap.get(bond.getEnd());

// attach bond skipped
Expand Down
Expand Up @@ -21,7 +21,6 @@
import com.google.common.collect.FluentIterable;
import org.openscience.cdk.CDKConstants;
import org.openscience.cdk.exception.CDKException;
import org.openscience.cdk.exception.InvalidSmilesException;
import org.openscience.cdk.geometry.GeometryUtil;
import org.openscience.cdk.interfaces.IAtom;
import org.openscience.cdk.interfaces.IAtomContainer;
Expand All @@ -44,21 +43,17 @@
import org.openscience.cdk.renderer.generators.IGeneratorParameter;
import org.openscience.cdk.renderer.generators.standard.SelectionVisibility;
import org.openscience.cdk.renderer.generators.standard.StandardGenerator;
import org.openscience.cdk.silent.SilentChemObjectBuilder;
import org.openscience.cdk.smiles.SmilesParser;
import org.openscience.cdk.tools.LoggingToolFactory;

import javax.vecmath.Point2d;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

Expand Down Expand Up @@ -532,7 +527,7 @@ private Map<IChemObject, Color> makeHighlightAtomMap(List<IAtomContainer> reacta
}
if (colorIdx > prevPalletIdx) {
for (IBond bond : mol.bonds()) {
IAtom a1 = bond.getBeg();
IAtom a1 = bond.getBegin();
IAtom a2 = bond.getEnd();
Color c1 = colorMap.get(a1);
Color c2 = colorMap.get(a2);
Expand All @@ -550,7 +545,7 @@ private Map<IChemObject, Color> makeHighlightAtomMap(List<IAtomContainer> reacta
}
}
for (IBond bond : mol.bonds()) {
IAtom a1 = bond.getBeg();
IAtom a1 = bond.getBegin();
IAtom a2 = bond.getEnd();
Color c1 = colorMap.get(a1);
Color c2 = colorMap.get(a2);
Expand Down Expand Up @@ -1106,7 +1101,7 @@ private double medianBondLength(Collection<IBond> bonds) {
int nBonds = 0;
double[] lengths = new double[bonds.size()];
for (IBond bond : bonds) {
Point2d p1 = bond.getBeg().getPoint2d();
Point2d p1 = bond.getBegin().getPoint2d();
Point2d p2 = bond.getEnd().getPoint2d();
// watch out for overlaid atoms (occur in multiple group Sgroups)
if (!p1.equals(p2))
Expand Down
Expand Up @@ -1063,7 +1063,7 @@ private int countExplicitHydrogens(IAtom atom, List<IBond> connectedBonds) {
private List<IBond> heavyBonds(final List<IBond> bonds) {
final List<IBond> heavy = new ArrayList<IBond>(bonds.size());
for (final IBond bond : bonds) {
if (!(bond.getBeg().getSymbol().equals("H") && bond.getEnd().getSymbol().equals("H"))) {
if (!(bond.getBegin().getSymbol().equals("H") && bond.getEnd().getSymbol().equals("H"))) {
heavy.add(bond);
}
}
Expand Down
Expand Up @@ -24,11 +24,9 @@
package org.openscience.cdk.graph;

import com.google.common.collect.Maps;
import org.openscience.cdk.interfaces.IAtom;
import org.openscience.cdk.interfaces.IAtomContainer;
import org.openscience.cdk.interfaces.IBond;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

Expand Down Expand Up @@ -71,7 +69,7 @@ public static int[][] toAdjList(IAtomContainer container) {

for (IBond bond : container.bonds()) {

int v = container.indexOf(bond.getBeg());
int v = container.indexOf(bond.getBegin());
int w = container.indexOf(bond.getEnd());

if (v < 0 || w < 0)
Expand Down Expand Up @@ -117,7 +115,7 @@ public static int[][] toAdjListSubgraph(IAtomContainer container, Set<IBond> inc
if (!include.contains(bond))
continue;

int v = container.indexOf(bond.getBeg());
int v = container.indexOf(bond.getBegin());
int w = container.indexOf(bond.getEnd());

if (v < 0 || w < 0)
Expand Down Expand Up @@ -161,7 +159,7 @@ public static int[][] toAdjList(IAtomContainer container, EdgeToBondMap bondMap)

for (IBond bond : container.bonds()) {

int v = container.indexOf(bond.getBeg());
int v = container.indexOf(bond.getBegin());
int w = container.indexOf(bond.getEnd());

if (v < 0 || w < 0)
Expand Down
Expand Up @@ -140,7 +140,7 @@ private void buildSpanningTree(IAtomContainer atomContainer) {
for (int b = 0; b < totalEdgeCount; b++) {
bondsInTree[b] = false;
bond = atomContainer.getBond(b);
vertex1 = Integer.parseInt((bond.getBeg()).getProperty(ATOM_NUMBER).toString());
vertex1 = Integer.parseInt((bond.getBegin()).getProperty(ATOM_NUMBER).toString());
vertex2 = Integer.parseInt((bond.getEnd()).getProperty(ATOM_NUMBER).toString());
//this below is a little bit slower
//v1 = atomContainer.indexOf(bond.getAtomAt(0))+1;
Expand Down Expand Up @@ -209,8 +209,8 @@ public IAtomContainer getPath(IAtomContainer spt, IAtom atom1, IAtom atom2) thro
private IRing getRing(IAtomContainer spt, IBond bond) {
IRing ring = spt.getBuilder().newInstance(IRing.class);
PathTools.resetFlags(spt);
ring.addAtom(bond.getBeg());
PathTools.depthFirstTargetSearch(spt, bond.getBeg(), bond.getEnd(), ring);
ring.addAtom(bond.getBegin());
PathTools.depthFirstTargetSearch(spt, bond.getBegin(), bond.getEnd(), ring);
ring.addBond(bond);
return ring;
}
Expand Down
Expand Up @@ -51,7 +51,7 @@ public static int[][] getMatrix(IAtomContainer container) {
int[][] conMat = new int[container.getAtomCount()][container.getAtomCount()];
for (int f = 0; f < container.getBondCount(); f++) {
bond = container.getBond(f);
indexAtom1 = container.indexOf(bond.getBeg());
indexAtom1 = container.indexOf(bond.getBegin());
indexAtom2 = container.indexOf(bond.getEnd());
conMat[indexAtom1][indexAtom2] = 1;
conMat[indexAtom2][indexAtom1] = 1;
Expand Down
Expand Up @@ -234,7 +234,7 @@ public boolean cyclic(IAtom atom) {
*/
public boolean cyclic(IBond bond) {
// XXX: linear search - but okay for now
int u = container.indexOf(bond.getBeg());
int u = container.indexOf(bond.getBegin());
int v = container.indexOf(bond.getEnd());
if (u < 0 || v < 0) throw new NoSuchElementException("atoms of the bond are not found in the container");
return searcher.cyclic(u, v);
Expand Down Expand Up @@ -339,7 +339,7 @@ public IAtomContainer ringFragments() {

for (IBond bond : container.bonds()) {

IAtom either = bond.getBeg();
IAtom either = bond.getBegin();
IAtom other = bond.getEnd();

int u = container.indexOf(either);
Expand Down Expand Up @@ -438,7 +438,7 @@ private IAtomContainer toFragment(int[] vertices) {

// include bonds that have both atoms in the atoms set
for (IBond bond : container.bonds()) {
IAtom either = bond.getBeg();
IAtom either = bond.getBegin();
IAtom other = bond.getEnd();
if (atoms.contains(either) && atoms.contains(other)) {
bonds.add(bond);
Expand Down
2 changes: 1 addition & 1 deletion base/data/src/main/java/org/openscience/cdk/Bond.java
Expand Up @@ -234,7 +234,7 @@ public IAtom getAtom(int position) {
/**
* {@inheritDoc}
*/
public IAtom getBeg() {
public IAtom getBegin() {
return atoms[0];
}

Expand Down
12 changes: 6 additions & 6 deletions base/data/src/test/java/org/openscience/cdk/BondTest.java
Expand Up @@ -51,7 +51,7 @@ public IChemObject newTestObject() {
public void testBond() {
IBond bond = new Bond();
Assert.assertEquals(0, bond.getAtomCount());
Assert.assertNull(bond.getBeg());
Assert.assertNull(bond.getBegin());
Assert.assertNull(bond.getEnd());
Assert.assertNull(bond.getOrder());
Assert.assertEquals(IBond.Stereo.NONE, bond.getStereo());
Expand All @@ -68,7 +68,7 @@ public void testBond_arrayIAtom() {

IBond bond1 = new Bond(new IAtom[]{atom1, atom2, atom3, atom4, atom5});
Assert.assertEquals(5, bond1.getAtomCount());
Assert.assertEquals(atom1, bond1.getBeg());
Assert.assertEquals(atom1, bond1.getBegin());
Assert.assertEquals(atom2, bond1.getEnd());
}

Expand All @@ -83,7 +83,7 @@ public void testBond_arrayIAtom_IBond_Order() {

IBond bond1 = new Bond(new IAtom[]{atom1, atom2, atom3, atom4, atom5}, IBond.Order.SINGLE);
Assert.assertEquals(5, bond1.getAtomCount());
Assert.assertEquals(atom1, bond1.getBeg());
Assert.assertEquals(atom1, bond1.getBegin());
Assert.assertEquals(atom2, bond1.getEnd());
Assert.assertEquals(IBond.Order.SINGLE, bond1.getOrder());
}
Expand All @@ -96,7 +96,7 @@ public void testBond_IAtom_IAtom() {
IBond bond = new Bond(c, o);

Assert.assertEquals(2, bond.getAtomCount());
Assert.assertEquals(c, bond.getBeg());
Assert.assertEquals(c, bond.getBegin());
Assert.assertEquals(o, bond.getEnd());
Assert.assertEquals(IBond.Order.SINGLE, bond.getOrder());
Assert.assertEquals(IBond.Stereo.NONE, bond.getStereo());
Expand All @@ -110,7 +110,7 @@ public void testBond_IAtom_IAtom_IBond_Order() {
IBond bond = new Bond(c, o, IBond.Order.DOUBLE);

Assert.assertEquals(2, bond.getAtomCount());
Assert.assertEquals(c, bond.getBeg());
Assert.assertEquals(c, bond.getBegin());
Assert.assertEquals(o, bond.getEnd());
Assert.assertTrue(bond.getOrder() == IBond.Order.DOUBLE);
Assert.assertEquals(IBond.Stereo.NONE, bond.getStereo());
Expand All @@ -124,7 +124,7 @@ public void testBond_IAtom_IAtom_IBond_Order_IBond_Stereo() {
IBond bond = new Bond(c, o, IBond.Order.SINGLE, IBond.Stereo.UP);

Assert.assertEquals(2, bond.getAtomCount());
Assert.assertEquals(c, bond.getBeg());
Assert.assertEquals(c, bond.getBegin());
Assert.assertEquals(o, bond.getEnd());
Assert.assertTrue(bond.getOrder() == IBond.Order.SINGLE);
Assert.assertEquals(IBond.Stereo.UP, bond.getStereo());
Expand Down
Expand Up @@ -245,9 +245,9 @@ public IAtom getAtom(int position) {
/**
* {@inheritDoc}
*/
public IAtom getBeg() {
public IAtom getBegin() {
logger.debug("Getting begin atom");
return super.getBeg();
return super.getBegin();
}

/**
Expand Down
Expand Up @@ -50,7 +50,7 @@ public IChemObject newTestObject() {
public void testDebugBond() {
IBond bond = new DebugBond();
Assert.assertEquals(0, bond.getAtomCount());
Assert.assertNull(bond.getBeg());
Assert.assertNull(bond.getBegin());
Assert.assertNull(bond.getEnd());
Assert.assertNull(bond.getOrder());
Assert.assertEquals(IBond.Stereo.NONE, bond.getStereo());
Expand All @@ -67,7 +67,7 @@ public void testDebugBond_arrayIAtom() {

IBond bond1 = new DebugBond(new IAtom[]{atom1, atom2, atom3, atom4, atom5});
Assert.assertEquals(5, bond1.getAtomCount());
Assert.assertEquals(atom1, bond1.getBeg());
Assert.assertEquals(atom1, bond1.getBegin());
Assert.assertEquals(atom2, bond1.getEnd());
}

Expand All @@ -82,7 +82,7 @@ public void testDebugBond_arrayIAtom_IBond_Order() {

IBond bond1 = new DebugBond(new IAtom[]{atom1, atom2, atom3, atom4, atom5}, IBond.Order.SINGLE);
Assert.assertEquals(5, bond1.getAtomCount());
Assert.assertEquals(atom1, bond1.getBeg());
Assert.assertEquals(atom1, bond1.getBegin());
Assert.assertEquals(atom2, bond1.getEnd());
Assert.assertEquals(IBond.Order.SINGLE, bond1.getOrder());
}
Expand All @@ -95,7 +95,7 @@ public void testDebugBond_IAtom_IAtom() {
IBond bond = new DebugBond(c, o);

Assert.assertEquals(2, bond.getAtomCount());
Assert.assertEquals(c, bond.getBeg());
Assert.assertEquals(c, bond.getBegin());
Assert.assertEquals(o, bond.getEnd());
Assert.assertEquals(IBond.Order.SINGLE, bond.getOrder());
Assert.assertEquals(IBond.Stereo.NONE, bond.getStereo());
Expand All @@ -109,7 +109,7 @@ public void testDebugBond_IAtom_IAtom_IBond_Order() {
IBond bond = new DebugBond(c, o, IBond.Order.DOUBLE);

Assert.assertEquals(2, bond.getAtomCount());
Assert.assertEquals(c, bond.getBeg());
Assert.assertEquals(c, bond.getBegin());
Assert.assertEquals(o, bond.getEnd());
Assert.assertTrue(bond.getOrder() == IBond.Order.DOUBLE);
Assert.assertEquals(IBond.Stereo.NONE, bond.getStereo());
Expand All @@ -123,7 +123,7 @@ public void testDebugBond_IAtom_IAtom_IBond_Order_IBond_Stereo() {
IBond bond = new DebugBond(c, o, IBond.Order.SINGLE, IBond.Stereo.UP);

Assert.assertEquals(2, bond.getAtomCount());
Assert.assertEquals(c, bond.getBeg());
Assert.assertEquals(c, bond.getBegin());
Assert.assertEquals(o, bond.getEnd());
Assert.assertTrue(bond.getOrder() == IBond.Order.SINGLE);
Assert.assertEquals(IBond.Stereo.UP, bond.getStereo());
Expand Down
Expand Up @@ -152,7 +152,7 @@ enum Stereo {
*
* @return the begin atom
*/
IAtom getBeg();
IAtom getBegin();

/**
* Access the end (or second) atom of the bond.
Expand Down Expand Up @@ -183,7 +183,7 @@ enum Stereo {
* and the more correct {@link #getConnectedAtoms(IAtom)} should be used.
* <p>
* <pre>{@code
* IAtom beg = bond.getBeg();
* IAtom beg = bond.getBegin();
* IAtom end = bond.getEnd();
* // bond.getConnectedAtom(beg) == end
* // bond.getConnectedAtom(end) == beg
Expand All @@ -202,7 +202,7 @@ enum Stereo {
* and the more correct {@link #getConnectedAtoms(IAtom)} should be used.
* <p>
* <pre>{@code
* IAtom beg = bond.getBeg();
* IAtom beg = bond.getBegin();
* IAtom end = bond.getEnd();
* // bond.getOther(beg) == end
* // bond.getOther(end) == beg
Expand Down
Expand Up @@ -208,7 +208,7 @@ private boolean checkGeometric(int u1, int u2, int[] mapping) {
// bond is undirected so we need to ensure v1 is the first atom in the bond
// we also need to to swap the substituents later
boolean swap = false;
if (targetElement.getStereoBond().getBeg() != target.getAtom(v1)) {
if (targetElement.getStereoBond().getBegin() != target.getAtom(v1)) {
int tmp = v1;
v1 = v2;
v2 = tmp;
Expand Down Expand Up @@ -332,7 +332,7 @@ private static int[] indexElements(Map<IAtom, Integer> map, IStereoElement[] ele
indices[nElements++] = idx;
} else if (element instanceof IDoubleBondStereochemistry) {
IDoubleBondStereochemistry dbs = (IDoubleBondStereochemistry) element;
int idx1 = map.get(dbs.getStereoBond().getBeg());
int idx1 = map.get(dbs.getStereoBond().getBegin());
int idx2 = map.get(dbs.getStereoBond().getEnd());
elements[idx2] = elements[idx1] = element;
types[idx1] = types[idx2] = Type.Geometric;
Expand Down
Expand Up @@ -86,7 +86,7 @@ public boolean matches(IBond bond) {
public static CTFileQueryBond ofType(IBond bond, int type) {
CTFileQueryBond queryBond = new CTFileQueryBond(bond.getBuilder());
queryBond.setOrder(Order.UNSET);
queryBond.setAtoms(new IAtom[]{bond.getBeg(), bond.getEnd()});
queryBond.setAtoms(new IAtom[]{bond.getBegin(), bond.getEnd()});
switch (type) {
case 1:
queryBond.setType(Type.SINGLE);
Expand Down

0 comments on commit 1c315b6

Please sign in to comment.