code: private static boolean queryAdjacencyAndOrder(IBond bond1, IBond bond2, IBond queryBond1, IBond queryBond2) {
  
          IAtom centralAtom = null;
          IAtom centralQueryAtom = null;
  
          if (bond1.contains(bond2.getBegin())) {
              centralAtom = bond2.getBegin();
          } else if (bond1.contains(bond2.getEnd())) {
              centralAtom = bond2.getEnd();
          }
  
          if (queryBond1.contains(queryBond2.getBegin())) {
              centralQueryAtom = queryBond2.getBegin();
          } else if (queryBond1.contains(queryBond2.getEnd())) {
              centralQueryAtom = queryBond2.getEnd();
          }
  
          if (centralAtom != null && centralQueryAtom != null && ((IQueryAtom) centralQueryAtom).matches(centralAtom)) {
              IQueryAtom queryAtom1 = (IQueryAtom) queryBond1.getOther(centralQueryAtom);
              IQueryAtom queryAtom2 = (IQueryAtom) queryBond2.getOther(centralQueryAtom);
              IAtom atom1 = bond1.getOther(centralAtom);
              IAtom atom2 = bond2.getOther(centralAtom);
              if (queryAtom1.matches(atom1) && queryAtom2.matches(atom2) || queryAtom1.matches(atom2)
                      && queryAtom2.matches(atom1)) {
                  return true;
              } else {
                  return false;
              }
          } else {
              return centralAtom == null && centralQueryAtom == null;
          }
  
      }
docs: Determines if 2 bondA1 have 1 atom in common if second is atom query AtomContainer
  and wheter the order of the atoms is correct (atoms match).
  
  @param  bondA1  first bondA1
  @param  bond2  second bondA1
  @param queryBond1 first query bondA1
  @param queryBond2 second query bondA1
  @return    the symbol of the common atom or "" if the 2 bonds have no common atom