Class Enum2TagUtils


  • public class Enum2TagUtils
    extends java.lang.Object
    In Weka, configuration with a specific set of possible values is implemented using Tag. These utilities make it possible to use an enum as the set of tags for a given config parameter.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  Enum2TagUtils.TagInfo
      Enums whose values are to be used as tags should implement this.
    • Constructor Summary

      Constructors 
      Constructor Description
      Enum2TagUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <E extends java.lang.Enum<E> & Enum2TagUtils.TagInfo>
      E
      getElement​(java.lang.Class<E> enumClass, java.lang.String option)  
      static <E extends java.lang.Enum<E>>
      E
      getElement​(java.lang.Class<E> enumClass, weka.core.SelectedTag tag)  
      static <E extends java.lang.Enum<E> & Enum2TagUtils.TagInfo>
      weka.core.Tag[]
      getTags​(java.lang.Class<E> enumClass)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Enum2TagUtils

        public Enum2TagUtils()
    • Method Detail

      • getTags

        public static <E extends java.lang.Enum<E> & Enum2TagUtils.TagInfo> weka.core.Tag[] getTags​(java.lang.Class<E> enumClass)
        Parameters:
        enumClass - The enum whose members are used as tags
        Returns:
        Array of tags to be used for Weka configuration
      • getElement

        public static <E extends java.lang.Enum<E>> E getElement​(java.lang.Class<E> enumClass,
                                                                 weka.core.SelectedTag tag)
        Parameters:
        enumClass - The enum whose members are used as tags
        tag - specifying which enum element to return. The id of this tag must match the desired element's ordinal() value.
        Returns:
        The selected element of this enum
      • getElement

        public static <E extends java.lang.Enum<E> & Enum2TagUtils.TagInfo> E getElement​(java.lang.Class<E> enumClass,
                                                                                         java.lang.String option)
        Parameters:
        enumClass - The enum whose members are used as tags
        option - The option specified by the user; it must match getOptionString for one enum member
        Returns:
        The enum member specified by the option string