<commit_before>//----------------------------------------------------------------------------//
//                                                                            //
//                               A c t i o n s                                //
//                                                                            //
//  Copyright (C) <NAME> 2000-2007. All rights reserved.               //
//  This software is released under the GNU General Public License.           //
//  Contact author at <EMAIL> to report bugs & suggestions. //
//----------------------------------------------------------------------------//
//
package omr.action;

import static omr.action.ActionDescriptor.*;

import omr.log.Logger;

import java.io.InputStream;
import java.util.*;

import javax.xml.bind.*;
import javax.xml.bind.annotation.*;

/**
 * Class <code>Actions</code> handles all actions descriptors.
 *
 * @author <NAME>
 * @version $Id$
 */
@XmlAccessorType(XmlAccessType.NONE)
@XmlRootElement(name = "actions")
public class Actions
{
    //~ Static fields/initializers ---------------------------------------------

    /** Usual logger utility */
    private static final Logger logger = Logger.getLogger(Actions.class);

    /** Context for JAXB unmarshalling */
    private static JAXBContext jaxbContext;

    /** The collection of all actions loaded so far */
    private static final Set<ActionDescriptor> allDescriptors = new LinkedHashSet<ActionDescriptor>();

    //~ Enumerations -----------------------------------------------------------

    /**
     * Predefined list of domain names. Through the action list files, the user
     * will be able to add new domain names.
     * This classification is mainly used to define the related pull-down menus.
     */
    public static enum Domain {
        //~ Enumeration constant initializers ----------------------------------


        /** Domain of sheet actions */
        SHEET,
        /** Domain of individual steps */
        STEP, 
        /** Domain of score actions */
        SCORE, 
        /** Domain of MIDI features */
        MIDI, 
        /** Domain of various view features */
        VIEW, 
        /** Domain of utilities */
        TOOL, 
        /** Domain of help information */
        HELP;
    }

    /**
     * Predefined list of section names within a domain. The user can add new
     * section names, they will be added to the end of the predefined list.
     */
    public static enum Section {
        //~ Enumeration constant initializers ----------------------------------


        /** Section #1 */
        IMPORT,
        /** Section #2 */
        EDIT, 
        /** Section #3 */
        EXPORT, 
        /** Section #4 */
        END;
    }

    //~ Instance fields --------------------------------------------------------

    /** Collection of descriptors loaded by unmarshalling one file */
    @XmlElement(name = "action")
    private List<ActionDescriptor> descriptors = new ArrayList<ActionDescriptor>();

    //~ Constructors -----------------------------------------------------------

    //---------//
    // Actions //
    //---------//
    /** Not meant to be instantiated */
    private Actions ()
    {
    }

    //~ Methods ----------------------------------------------------------------

    //-------------------//
    // getAllDescriptors //
    //-------------------//
    /**
     * Report the collection of descriptors loaded so far
     * @return all the loaded action descriptors
     */
    public static Set<ActionDescriptor> getAllDescriptors ()
    {
        return allDescriptors;
    }

    //----------------//
    // getDomainNames //
    //----------------//
    /**
     * Report the whole collection of domain names, starting with the predefined
     * ones
     * @return the collection of domain names
     */
    public static Set<String> getDomainNames ()
    {
        Set<String> names = new LinkedHashSet<String>();

        // Predefined ones, except HELP
        for (Domain domain : Domain.values()) {
            if (domain != Domain.HELP) {
                names.add(domain.name());
            }
        }

        // User-specified ones
        for (ActionDescriptor desc : allDescriptors) {
            names.add(desc.domain);
        }

        // Add HELP as the last one
        names.add(Domain.HELP.name());

        return names;
    }

    //-----------------//
    // getSectionNames //
    //-----------------//
    /**
     * Report the whole collection of section names, starting with the
     * predefined ones
     * @return the collection of section names
     */
    public static Set<String> getSectionNames ()
    {
        Set<String> names = new LinkedHashSet<String>();

        // Predefined ones
        for (Section section : Section.values()) {
            names.add(section.name());
        }

        // User-specified ones
        for (ActionDescriptor desc : allDescriptors) {
            names.add(desc.section);
        }

        return names;
    }<commit_msg>Make sure HELP if the very last top-down menu<commit_after>//----------------------------------------------------------------------------//
//                                                                            //
//                               A c t i o n s                                //
//                                                                            //
//  Copyright (C) <NAME> 2000-2007. All rights reserved.               //
//  This software is released under the GNU General Public License.           //
//  Contact author at <EMAIL> to report bugs & suggestions. //
//----------------------------------------------------------------------------//
//
package omr.action;

import omr.log.Logger;

import java.io.InputStream;
import java.util.*;

import javax.xml.bind.*;
import javax.xml.bind.annotation.*;

/**
 * Class <code>Actions</code> handles all actions descriptors.
 *
 * @author <NAME>
 * @version $Id$
 */
@XmlAccessorType(XmlAccessType.NONE)
@XmlRootElement(name = "actions")
public class Actions
{
    //~ Static fields/initializers ---------------------------------------------

    /** Usual logger utility */
    private static final Logger logger = Logger.getLogger(Actions.class);

    /** Context for JAXB unmarshalling */
    private static JAXBContext jaxbContext;

    /** The collection of all actions loaded so far */
    private static final Set<ActionDescriptor> allDescriptors = new LinkedHashSet<ActionDescriptor>();

    //~ Enumerations -----------------------------------------------------------

    /**
     * Predefined list of domain names. Through the action list files, the user
     * will be able to add new domain names.
     * This classification is mainly used to define the related pull-down menus.
     */
    public static enum Domain {
        //~ Enumeration constant initializers ----------------------------------


        /** Domain of sheet actions */
        SHEET,
        /** Domain of individual steps */
        STEP, 
        /** Domain of score actions */
        SCORE, 
        /** Domain of MIDI features */
        MIDI, 
        /** Domain of various view features */
        VIEW, 
        /** Domain of utilities */
        TOOL, 
        /** Domain of help information */
        HELP;
    }

    /**
     * Predefined list of section names within a domain. The user can add new
     * section names, they will be added to the end of the predefined list.
     */
    public static enum Section {
        //~ Enumeration constant initializers ----------------------------------


        /** Section #1 */
        IMPORT,
        /** Section #2 */
        EDIT, 
        /** Section #3 */
        EXPORT, 
        /** Section #4 */
        END;
    }

    //~ Instance fields --------------------------------------------------------

    /** Collection of descriptors loaded by unmarshalling one file */
    @XmlElement(name = "action")
    private List<ActionDescriptor> descriptors = new ArrayList<ActionDescriptor>();

    //~ Constructors -----------------------------------------------------------

    //---------//
    // Actions //
    //---------//
    /** Not meant to be instantiated */
    private Actions ()
    {
    }

    //~ Methods ----------------------------------------------------------------

    //-------------------//
    // getAllDescriptors //
    //-------------------//
    /**
     * Report the collection of descriptors loaded so far
     * @return all the loaded action descriptors
     */
    public static Set<ActionDescriptor> getAllDescriptors ()
    {
        return allDescriptors;
    }

    //----------------//
    // getDomainNames //
    //----------------//
    /**
     * Report the whole collection of domain names, starting with the predefined
     * ones
     * @return the collection of domain names
     */
    public static Set<String> getDomainNames ()
    {
        Set<String> names = new LinkedHashSet<String>();

        // Predefined ones, except HELP
        for (Domain domain : Domain.values()) {
            if (domain != Domain.HELP) {
                names.add(domain.name());
            }
        }

        // User-specified ones, except HELP
        for (ActionDescriptor desc : allDescriptors) {
            if (!desc.domain.equalsIgnoreCase(Domain.HELP.toString())) {
                names.add(desc.domain);
            }
        }

        // Add HELP as the very last one
        names.add(Domain.HELP.name());

        return names;
    }

    //-----------------//
    // getSectionNames //
    //-----------------//
    /**
     * Report the whole collection of section names, starting with the
     * predefined ones
     * @return the collection of section names
     */
    public static Set<String> getSectionNames ()
    {
        Set<String> names = new LinkedHashSet<String>();

        // Predefined ones
        for (Section section : Section.values()) {
            names.add(section.name());
        }

        // User-specified ones
        for (ActionDescriptor desc : allDescriptors) {
            names.add(desc.section);
        }

        return names;
    }
{'fraction_non_alphanumeric': 0.21699500147015582, 'fraction_numerical': 0.0023522493384298734, 'mean_word_length': 1.1803418803418804, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2954662', 'n_tokens_mistral': 2411, 'n_tokens_neox': 2262, 'n_words': 736}