class ModularityUI implements StatisticsUI {

    private final StatSettings settings = new StatSettings();
    private ModularityPanel panel;
    private Modularity mod;

    @Override
    public JPanel getSettingsPanel() {
        panel = new ModularityPanel();
        return panel;
    }

    @Override
    public void setup(Statistics statistics) {
        this.mod = (Modularity) statistics;
        if (panel != null) {
            settings.load(mod);
            panel.setRandomize(mod.getRandom());
            panel.setUseWeight(mod.getUseWeight());
            panel.setResolution(mod.getResolution());
            panel.setInitialModularityClassIndex(mod.getInitialModularityClassIndex());
        }
    }

    @Override
    public void unsetup() {<FILL_FUNCTION_BODY>}

    @Override
    public Class<? extends Statistics> getStatisticsClass() {
        return Modularity.class;
    }

    @Override
    public String getValue() {
        DecimalFormat df = new DecimalFormat("###.###");
        return "" + df.format(mod.getModularity());
    }

    @Override
    public String getDisplayName() {
        return NbBundle.getMessage(getClass(), "ModularityUI.name");
    }

    @Override
    public String getCategory() {
        return StatisticsUI.CATEGORY_COMMUNITY_DETECTION;
    }

    @Override
    public int getPosition() {
        return 600;
    }

    @Override
    public String getShortDescription() {
        return NbBundle.getMessage(getClass(), "ModularityUI.shortDescription");
    }

    private static class StatSettings {

        private boolean randomize = true;
        private boolean useWeight = true;

        private void save(Modularity stat) {
            this.randomize = stat.getRandom();
            this.useWeight = stat.getUseWeight();
        }

        private void load(Modularity stat) {
            stat.setRandom(randomize);
            stat.setUseWeight(useWeight);
        }
    }
}

        if (panel != null) {
            mod.setRandom(panel.isRandomize());
            mod.setUseWeight(panel.useWeight());
            mod.setResolution(panel.resolution());
            mod.setInitialModularityClassIndex(panel.getInitialModularityClassIndex());
            settings.save(mod);
        }
        mod = null;
        panel = null;
    
<no_super_class>