Class FormulaRootElement

    • Constructor Detail

      • FormulaRootElement

        public FormulaRootElement​(FormulaDocument document)
    • Method Detail

      • getElementIndex

        public int getElementIndex​(int offset)
        Gets the child element index closest to the given offset. The offset is specified relative to the beginning of the document. Returns -1 if the Element is a leaf, otherwise returns the index of the Element that best represents the given location. Returns 0 if the location is less than the start offset. Returns getElementCount() - 1 if the location is greater than or equal to the end offset.
        Specified by:
        getElementIndex in interface Element
        Overrides:
        getElementIndex in class FormulaElement
        Parameters:
        offset - the specified offset >= 0
        Returns:
        the element index >= 0
      • getElementCount

        public int getElementCount()
        Gets the number of child elements contained by this element. If this element is a leaf, a count of zero is returned.
        Specified by:
        getElementCount in interface Element
        Overrides:
        getElementCount in class FormulaElement
        Returns:
        the number of child elements >= 0
      • getElement

        public Element getElement​(int index)
        Fetches the child element at the given index.
        Specified by:
        getElement in interface Element
        Overrides:
        getElement in class FormulaElement
        Parameters:
        index - the specified index >= 0
        Returns:
        the child element. If index is invalid, return null
      • isLeaf

        public boolean isLeaf()
        Is this element a leaf element? An element that may have children, even if it currently has no children, would return false.
        Specified by:
        isLeaf in interface Element
        Overrides:
        isLeaf in class FormulaElement
        Returns:
        true if a leaf element else false
      • getName

        public String getName()
        Fetches the name of the element. If the element is used to represent some type of structure, this would be the type name.
        Returns:
        the element name
      • setElements

        public void setElements​(FormulaElement[] elements)
      • setElement

        public void setElement​(int index,
                               FormulaElement element)
      • insertElement

        public void insertElement​(int index,
                                  FormulaElement element)
      • removeElement

        public void removeElement​(int index)
      • revalidateStructure

        public void revalidateStructure()
      • revalidateNodePositions

        public void revalidateNodePositions()
      • print

        public void print()
      • clear

        public void clear()