Class DebugNodeModelUtils


  • public final class DebugNodeModelUtils
    extends Object
    Node model BSL-specific utility class. Contains utility methods for 1C:Enterprise Runtime debug process purposes.
    Restriction:
    This class is not intended to be sub-classed by clients.
    Restriction:
    This class is not intended to be instantiated by clients.
    • Method Detail

      • getModuleResourceOffset

        public static int getModuleResourceOffset​(Module module,
                                                  int line)
        Compute module resource offset by line number.

        Returns the first node offset with line number equals or greater than the given. If there aren't nodes with that line number, method will return offset of last module node.

        Parameters:
        module - the BSL module, cannot be null
        line - the line number
        Returns:
        module the resource offset
      • getValidModuleResourceOffset

        public static int getValidModuleResourceOffset​(Module module,
                                                       int line)
        Compute valid module resource offset of module by the line number.

        If given line of module begins with Function ... method will return the offset after entire method declaration. Otherwise method will return #getModuleResourceOffset(Resource, int) result.

        Parameters:
        module - the BSL module, cannot be null
        line - the line number
        Returns:
        a valid module resource offset
      • getModuleResourceLine

        public static int getModuleResourceLine​(Module module,
                                                int offset)
        Compute module resource line number by the given offset.

        Returns first node line number with offset equals or greater than given. If there aren't nodes with that offset, method will return line number of last module node.

        Parameters:
        module - the BSL module, cannot be null
        offset - the offset
        Returns:
        the line number
      • getModuleResourceContent

        public static String getModuleResourceContent​(Module module)
        Returns module resource content. Returns content as String.
        Parameters:
        module - the BSL module to get content for, cannot be null
        Returns:
        the content of resource as String, never null
      • getLineMethod

        public static Method getLineMethod​(Module module,
                                           int line)
        Returns method of module by line number, or null, if there isn't one.
        Parameters:
        module - the BSL module, cannot be null
        line - line number of module
        Returns:
        method by given line number, can be null
      • belongToMethod

        public static boolean belongToMethod​(org.eclipse.emf.ecore.EObject variable,
                                             Method method)
        Returns whether the given variable belong to the given method.
        Parameters:
        variable - the variable, cannot be null
        method - the method, cannot be null
        Returns:
        whether the given variable belong to given method
      • isElementBeforeOffset

        public static boolean isElementBeforeOffset​(org.eclipse.emf.ecore.EObject element,
                                                    int offset)
        Returns whether the given element is before the given offset.
        Parameters:
        element - the element, cannot be null
        offset - the offset
        Returns:
        whether the given element is before offset