code: private static boolean queryAdjacency(IBond bondA1, IBond bondB1, IBond bondA2, IBond bondB2) {
  
          IAtom atom1 = null;
          IAtom atom2 = null;
  
          if (bondA1.contains(bondB1.getBegin())) {
              atom1 = bondB1.getBegin();
          } else if (bondA1.contains(bondB1.getEnd())) {
              atom1 = bondB1.getEnd();
          }
  
          if (bondA2.contains(bondB2.getBegin())) {
              atom2 = bondB2.getBegin();
          } else if (bondA2.contains(bondB2.getEnd())) {
              atom2 = bondB2.getEnd();
          }
  
          if (atom1 != null && atom2 != null) {
              // well, this looks fishy: the atom2 is not always atom IQueryAtom !
              return ((IQueryAtom) atom2).matches(atom1);
          } else {
              return atom1 == null && atom2 == null;
          }
  
      }
docs: Determines if 2 bondA1 have 1 atom in common if second is atom query AtomContainer
  
  @param  atom1  first bondA1
  @param  bondB1  second bondA1
  @return    the symbol of the common atom or "" if
  the 2 bonds have no common atom