<commit_before>package hudson.plugins.promoted_builds;

import java.util.AbstractList;
import java.util.List;

/**
 * List of {@link PromotionBadge}s indicating how a promotion happened.
 * 
 * @author <NAME>
 */
public final class PromotionBadgeList extends AbstractList<PromotionBadge> {
    /**
     * Matches with {@link PromotionCriterion#name}.
     */
    public final String criterion;

    private final PromotionBadge[] badges;

    public PromotionBadgeList(PromotionCriterion criterion, List<PromotionBadge> badges) {
        this.criterion = criterion.getName();
        this.badges = badges.toArray(new PromotionBadge[badges.size()]);
    }

    public String getName() {
        return criterion;
    }

    public boolean isFor(PromotionCriterion criterion) {
        return criterion.getName().equals(this.criterion);
    }

    public PromotionBadge get(int index) {<commit_msg>record promotion timestamp.<commit_after>package hudson.plugins.promoted_builds;

import hudson.Util;

import java.util.AbstractList;
import java.util.Calendar;
import java.util.List;
import java.util.GregorianCalendar;

/**
 * List of {@link PromotionBadge}s indicating how a promotion happened.
 * 
 * @author <NAME>
 */
public final class PromotionBadgeList extends AbstractList<PromotionBadge> {
    /**
     * Matches with {@link PromotionCriterion#name}.
     */
    public final String criterion;

    private final PromotionBadge[] badges;

    /**
     * When did the promotion happen?
     */
    public final Calendar timestamp = new GregorianCalendar();

    public PromotionBadgeList(PromotionCriterion criterion, List<PromotionBadge> badges) {
        this.criterion = criterion.getName();
        this.badges = badges.toArray(new PromotionBadge[badges.size()]);
    }

    public String getName() {
        return criterion;
    }

    /**
     * Gets the string that says how long since this promotion had happened.
     *
     * @return
     *      string like "3 minutes" "1 day" etc.
     */
    public String getTimestampString() {
        long duration = new GregorianCalendar().getTimeInMillis()-timestamp.getTimeInMillis();
        return Util.getTimeSpanString(duration);
    }

    public boolean isFor(PromotionCriterion criterion) {
        return criterion.getName().equals(this.criterion);
    }

    public PromotionBadge get(int index) {
{'fraction_non_alphanumeric': 0.09856175972927242, 'fraction_numerical': 0.0008460236886632825, 'mean_word_length': 3.3877551020408165, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '7321785', 'n_tokens_mistral': 697, 'n_tokens_neox': 658, 'n_words': 168}