class AtomDiff {

    public static IDifference difference(IChemObject first, IChemObject second) {
        if (!(first instanceof IAtom && second instanceof IAtom)) {
            return null;
        }
        IAtom firstElem = (IAtom) first;
        IAtom secondElem = (IAtom) second;
        ChemObjectDifference totalDiff = new ChemObjectDifference("AtomDiff");
        totalDiff.addChild(IntegerDifference.construct("H", firstElem.getImplicitHydrogenCount(),
                secondElem.getImplicitHydrogenCount()));
        totalDiff
                .addChild(IntegerDifference.construct("SP", firstElem.getStereoParity(), secondElem.getStereoParity()));
        totalDiff.addChild(Point2dDifference.construct("2D", firstElem.getPoint2d(), secondElem.getPoint2d()));
        totalDiff.addChild(Point3dDifference.construct("3D", firstElem.getPoint3d(), secondElem.getPoint3d()));
        totalDiff.addChild(Point3dDifference.construct("F3D", firstElem.getFractionalPoint3d(),
                secondElem.getFractionalPoint3d()));
        totalDiff.addChild(DoubleDifference.construct("C", firstElem.getCharge(), secondElem.getCharge()));
        totalDiff.addChild(AtomTypeDiff.difference(first, second));
        if (totalDiff.childCount() > 0) {
            return totalDiff;
        } else {
            return null;
        }
    }

    private  AtomDiff();

}