Class RuleBlock

    • Constructor Detail

      • RuleBlock

        protected RuleBlock​(java.lang.String name,
                            IRuleElement[] body)
        Creates a new rule block.
        Parameters:
        name - the name of the block (may be null if none is required)
        body - the body
    • Method Detail

      • getBodyElementCount

        public int getBodyElementCount()
        Description copied from interface: IRuleBlock
        Get the number of body elements of this rule.
        Specified by:
        getBodyElementCount in interface IRuleBlock
        Returns:
        The number of body elements of this rule.
      • getBodyElement

        public IRuleElement getBodyElement​(int index)
        Description copied from interface: IRuleBlock
        Get the element of this rule at the specified index.
        Specified by:
        getBodyElement in interface IRuleBlock
        Parameters:
        index - The 0-based index of the rule element to be returned.
        Returns:
        The rule element at the given index.
      • append

        protected void append​(IRuleElement elt)
        Appends an element to this body.
        Parameters:
        elt - the element to be appended
      • setBody

        public void setBody​(IRuleElement[] body)
        Changes the body elements.
        Parameters:
        body - the new body elements
      • addBodyElement

        public static IRuleElement[] addBodyElement​(IRuleElement[] body,
                                                    int index,
                                                    IRuleElement elt)
        Changes the given rule block. Shifts elements if necessary.
        Parameters:
        body - the body to modify
        index - index at which the specified element is to be inserted
        elt - the element to be inserted
        Returns:
        the changed body
      • addBodyElement

        public void addBodyElement​(int index,
                                   IRuleElement elt)
        Description copied from interface: IRuleBlock
        Changes the given rule block. Shifts elements if necessary.
        Specified by:
        addBodyElement in interface IRuleBlock
        Parameters:
        index - index at which the specified element is to be inserted
        elt - the element to be inserted
      • setParent

        protected void setParent​(ILanguageElement parent)
        Description copied from class: ProjectElement
        Changes the parent. Please override if children must be adjusted according. Shall be called only once per instance, but there is no limitation.
        Overrides:
        setParent in class ProjectElement
        Parameters:
        parent - the parent