<commit_before>/*
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package org.xwiki.mentions.internal.async;

import java.io.Serializable;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.xwiki.text.XWikiToStringBuilder;

/**
 * Object storing the minimal data required to analyse the mentions asynchronously.
 *
 * @version $Id$
 * @since 12.6
 */
public class MentionsData implements Serializable
{
    /**
     * Static object used to identify if elements has been persisted 
     * in the current JVM.
     */
    public static final MentionsData STOP = new MentionsData(true);

    private static final long serialVersionUID = -6254703177038788112L;

    private String documentReference;

    private String authorReference;

    private String version;

    private String wikiId;

    private final boolean stop;

    private long attempts;

    /**
     * Default constructor.
     */
    public MentionsData()
    {
        this.stop = false;
    }

    /**
     * Private constructor for the {@link MentionsData#STOP} static object.
     * @param stop stop flag.
     */
    private MentionsData(boolean stop)
    {
        this.stop = stop;
    }

    /**
     *
     * @return the document reference.
     */
    public String getDocumentReference()
    {
        return this.documentReference;
    }

    /**
     * Set the document reference.
     *
     * @param documentReference the document reference
     * @return the current object
     */
    public MentionsData setDocumentReference(String documentReference)
    {
        this.documentReference = documentReference;
        return this;
    }

    /**
     *
     * @return the document version.
     */
    public String getVersion()
    {
        return this.version;
    }

    /**
     * Set the document version.
     *
     * @param version the document version
     * @return the current object
     */
    public MentionsData setVersion(String version)
    {
        this.version = version;
        return this;
    }

    /**
     *
     * @return the author reference
     */
    public String getAuthorReference()
    {
        return this.authorReference;
    }

    /**
     * Set the author reference.
     *
     * @param authorReference the author reference
     * @return the current object
     */
    public MentionsData setAuthorReference(String authorReference)
    {
        this.authorReference = authorReference;
        return this;
    }

    /**
     *
     * @return the wiki id
     */
    public String getWikiId()
    {
        return this.wikiId;
    }

    /**
     *
     * @return {@code true} if the current object is {@link MentionsData#STOP}.  
     */
    public boolean isStop()
    {
        return this == STOP;
    }

    /**
     * Check if the stop flag is relevant. 
     * The stop flag is deprecated when the server restarts.
     *
     * @return {@code true} if the stop flag is still relevant.
     */
    public boolean isDeprecated()
    {
        return this.stop && this != STOP;<commit_msg>[Misc] Rename stop to stopFlag to prevent misunderstanding with the STOP field<commit_after>/*
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package org.xwiki.mentions.internal.async;

import java.io.Serializable;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.xwiki.text.XWikiToStringBuilder;

/**
 * Object storing the minimal data required to analyse the mentions asynchronously.
 *
 * @version $Id$
 * @since 12.6
 */
public class MentionsData implements Serializable
{
    /**
     * Static object used to identify if elements has been persisted 
     * in the current JVM.
     */
    public static final MentionsData STOP = new MentionsData(true);

    private static final long serialVersionUID = -6254703177038788112L;

    private String documentReference;

    private String authorReference;

    private String version;

    private String wikiId;

    private final boolean stopFlag;

    private long attempts;

    /**
     * Default constructor.
     */
    public MentionsData()
    {
        this.stopFlag = false;
    }

    /**
     * Private constructor for the {@link MentionsData#STOP} static object.
     *
     * @param stopFlag the stop flag
     */
    private MentionsData(boolean stopFlag)
    {
        this.stopFlag = stopFlag;
    }

    /**
     *
     * @return the document reference.
     */
    public String getDocumentReference()
    {
        return this.documentReference;
    }

    /**
     * Set the document reference.
     *
     * @param documentReference the document reference
     * @return the current object
     */
    public MentionsData setDocumentReference(String documentReference)
    {
        this.documentReference = documentReference;
        return this;
    }

    /**
     *
     * @return the document version.
     */
    public String getVersion()
    {
        return this.version;
    }

    /**
     * Set the document version.
     *
     * @param version the document version
     * @return the current object
     */
    public MentionsData setVersion(String version)
    {
        this.version = version;
        return this;
    }

    /**
     *
     * @return the author reference
     */
    public String getAuthorReference()
    {
        return this.authorReference;
    }

    /**
     * Set the author reference.
     *
     * @param authorReference the author reference
     * @return the current object
     */
    public MentionsData setAuthorReference(String authorReference)
    {
        this.authorReference = authorReference;
        return this;
    }

    /**
     *
     * @return the wiki id
     */
    public String getWikiId()
    {
        return this.wikiId;
    }

    /**
     *
     * @return {@code true} if the current object is {@link MentionsData#STOP}.  
     */
    public boolean isStop()
    {
        return this == STOP;
    }

    /**
     * Check if the stop flag is relevant. 
     * The stop flag is deprecated when the server restarts.
     *
     * @return {@code true} if the stop flag is still relevant.
     */
    public boolean isDeprecated()
    {
        return this.stopFlag && this != STOP;
{'fraction_non_alphanumeric': 0.0794386668337301, 'fraction_numerical': 0.009272021049993735, 'mean_word_length': 2.4081981212638772, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '6654081', 'n_tokens_mistral': 2197, 'n_tokens_neox': 2067, 'n_words': 777}