code: public static IAtom[] findTerminalAtoms(IAtomContainer container, IBond focus) {
          IAtom a = focus.getBegin();
          IAtom b = focus.getEnd();
          IAtom aPrev = a, bPrev = b;
          IAtom aNext, bNext;
          aNext = getOtherAtom(container, a, b);
          bNext = getOtherAtom(container, b, a);
          while (aNext != null && bNext != null) {
              IAtom tmp = getOtherAtom(container, aNext, aPrev);
              aPrev = aNext;
              aNext = tmp;
              tmp = getOtherAtom(container, bNext, bPrev);
              bPrev = bNext;
              bNext = tmp;
          }
          if (aPrev != null && bPrev != null)
              return new IAtom[]{aPrev, bPrev};
          return null;
      }
docs: Helper method to locate two terminal atoms in a container for this
  extended Cis/Trans element. The atoms are ordered such that the first
  atom is closer to first carrier.
  
  @param container structure representation
  @return the terminal atoms (ordered)