<commit_before>package gwt.material.design.addins.client.stepper.highlighter;

import com.google.gwt.user.client.ui.Widget;
import gwt.material.design.addins.client.MaterialAddins;
import gwt.material.design.client.MaterialDesignBase;

import java.util.ArrayList;
import java.util.List;

public class StepHighlighter {

    static {
        if (MaterialAddins.isDebug()) {
            MaterialDesignBase.injectCss(StepHighlighterDebugClientBundle.INSTANCE.stepHighlighterDebugCss());
        } else {
            MaterialDesignBase.injectCss(StepHighlighterClientBundle.INSTANCE.stepHighlighterCss());
        }
    }

    protected static final String HIGHLIGHT = "highlight";
    protected int currentIndex = 0;
    public List<Widget> widgets = new ArrayList<>();

    public void start() {
        currentIndex = 0;
        next();
    }

    public void next() {
        if (currentIndex < widgets.size()) {
            animate(currentIndex);
            currentIndex++;
        }
    }

    public void previous() {
        if (currentIndex > 0) {
            animate(currentIndex);
            currentIndex--;
        }
    }

    public void animate(int index) {
        clearHighlightStyle();
        Widget widget = widgets.get(index);
        if (widget != null) {
            widget.addStyleName(HIGHLIGHT);
        }
    }

    public void clearHighlightStyle() {
        for (Widget w : widgets) {
            w.removeStyleName(HIGHLIGHT);
        }
    }

    public void reset() {
        currentIndex = 0;
        clearHighlightStyle();
    }

    public void register( Widget object) {
        widgets.add(object);
    }

    public void unregister(Widget widget) {
        widgets.remove(widget);
    }

    public void unregisterAll() {
        widgets.forEach(widget -> unregister(widget));
    }
}<commit_msg>StepHighlighter - multiple registration of objects.<commit_after>package gwt.material.design.addins.client.stepper.highlighter;

import com.google.gwt.user.client.ui.Widget;
import gwt.material.design.addins.client.MaterialAddins;
import gwt.material.design.client.MaterialDesignBase;

import java.util.ArrayList;
import java.util.List;

public class StepHighlighter {

    static {
        if (MaterialAddins.isDebug()) {
            MaterialDesignBase.injectCss(StepHighlighterDebugClientBundle.INSTANCE.stepHighlighterDebugCss());
        } else {
            MaterialDesignBase.injectCss(StepHighlighterClientBundle.INSTANCE.stepHighlighterCss());
        }
    }

    protected static final String HIGHLIGHT = "highlight";
    protected int currentIndex = 0;
    public List<Widget> widgets = new ArrayList<>();

    public void start() {
        currentIndex = 0;
        next();
    }

    public void next() {
        if (currentIndex < widgets.size()) {
            animate(currentIndex);
            currentIndex++;
        }
    }

    public void previous() {
        if (currentIndex > 0) {
            animate(currentIndex);
            currentIndex--;
        }
    }

    public void animate(int index) {
        clearHighlightStyle();
        Widget widget = widgets.get(index);
        if (widget != null) {
            widget.addStyleName(HIGHLIGHT);
        }
    }

    public void clearHighlightStyle() {
        for (Widget w : widgets) {
            w.removeStyleName(HIGHLIGHT);
        }
    }

    public void reset() {
        currentIndex = 0;
        clearHighlightStyle();
    }

    public void register(Widget object) {
        widgets.add(object);
    }

    public void register(Widget... objects) {
        for (Widget widget : objects) {
            widgets.add(widget);
        }
    }

    public void unregister(Widget widget) {
        widgets.remove(widget);
    }

    public void unregisterAll() {
        widgets.forEach(widget -> unregister(widget));
    }
}
{'fraction_non_alphanumeric': 0.10430247718383312, 'fraction_numerical': 0.0020860495436766623, 'mean_word_length': 2.312607944732297, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6545545', 'n_tokens_mistral': 1104, 'n_tokens_neox': 1055, 'n_words': 212}