Class Enum

    • Field Detail

      • TYPE

        public static final IDatatype TYPE
        This constant represents the common type of all enums. Each specific enum type is assignable to this type.
      • TYPE_OF

        public static final Operation TYPE_OF
      • EQUALS

        public static final Operation EQUALS
      • NOTEQUALS

        public static final Operation NOTEQUALS
      • NOTEQUALS_ALIAS

        public static final Operation NOTEQUALS_ALIAS
      • ASSIGNMENT

        public static final Operation ASSIGNMENT
      • IS_DEFINED

        public static final Operation IS_DEFINED
      • ORDINAL

        public static final Operation ORDINAL
      • literals

        private java.util.List<EnumLiteral> literals
    • Constructor Detail

      • Enum

        private Enum()
        Creates the singleton instance for TYPE.
      • Enum

        protected Enum​(java.lang.String name,
                       ModelElement parent)
        Constructor for an empty enum.
        Parameters:
        name - Name of the enum
        parent - the object, in which this specific one is embedded
      • Enum

        protected Enum​(java.lang.String name,
                       DelegatingType singleton,
                       ModelElement parent)
        Constructor for an empty enum.
        Parameters:
        name - Name of the enum
        singleton - the instance which knows the operations
        parent - the object, in which this specific one is embedded
      • Enum

        public Enum​(java.lang.String name,
                    ModelElement parent,
                    java.lang.String... literals)
        Constructor for the enum.
        Parameters:
        name - Name of the enum
        parent - the object, in which this specific one is embedded
        literals - literals to put into this Enum
    • Method Detail

      • add

        private void add​(java.lang.String literal)
        Method to add an literal to the enumeration.
        Parameters:
        literal - the literal to add
      • add

        public boolean add​(EnumLiteral literal)
        Method to add an literal to the enumeration.
        Parameters:
        literal - the literal to add
        Returns:
        true if the operation was successful, false
      • has

        public boolean has​(EnumLiteral literal)
        Returns whether this enum defines the specified literal.
        Parameters:
        literal - the literal to test for
        Returns:
        true if it is defined, false else
      • get

        public EnumLiteral get​(java.lang.String name)
        Returns the enum literal with name name.
        Parameters:
        name - the name to search for
        Returns:
        the literal or null
      • accept

        public void accept​(IModelVisitor visitor)
        Accept method for the visitor.
        Parameters:
        visitor - The visitor, which should process this model element.
      • getLiteralCount

        public int getLiteralCount()
        Returns the number of literals.
        Returns:
        the number of literals
      • getLiteral

        public EnumLiteral getLiteral​(int index)
        Returns the specified literal.
        Parameters:
        index - the index of the literal to be returned
        Returns:
        the specified literal
        Throws:
        java.lang.IndexOutOfBoundsException - if index<0 || index>=getLiteralCount()
      • getLiteralByOrdinal

        public EnumLiteral getLiteralByOrdinal​(int ordinal)
        Returns a literal by its ordinal.
        Parameters:
        ordinal - the ordinal of the enumeration literal
        Returns:
        the literal or null if not found
      • getLiteralIndex

        public int getLiteralIndex​(EnumLiteral literal)
        Returns the index of the given literal.
        Parameters:
        literal - the literal to search for
        Returns:
        the index of the literal, -1 if not found
      • isOrdered

        public boolean isOrdered()
        Returns whether this enum is ordered.
        Returns:
        true if it is ordered, false else (default false)