class ElectronContainerDiff {

    public static IDifference difference(IChemObject first, IChemObject second) {
        if (!(first instanceof IElectronContainer && second instanceof IElectronContainer)) {
            return null;
        }
        IElectronContainer firstEC = (IElectronContainer) first;
        IElectronContainer secondEC = (IElectronContainer) second;
        IDifferenceList totalDiff = new ChemObjectDifference("ElectronContainerDiff");
        totalDiff.addChild(IntegerDifference.construct("eCount", firstEC.getElectronCount(),
                secondEC.getElectronCount()));
        totalDiff.addChild(ChemObjectDiff.difference(first, second));
        if (totalDiff.childCount() > 0) {
            return totalDiff;
        } else {
            return null;
        }
    }

    private  ElectronContainerDiff();

}