Class FormattedSourceCorrespondence

  • All Implemented Interfaces:
    java.lang.Comparable<FormattedSourceCorrespondence>

    public class FormattedSourceCorrespondence
    extends java.lang.Object
    implements java.lang.Comparable<FormattedSourceCorrespondence>
    A convenience utility wrapper for pretty printing SourceCorrespondence line numbers and other properties
    Author:
    Ben Holland
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compareTo​(FormattedSourceCorrespondence fsc)  
      long getEndLineNumber()
      Returns the source file ending line number (the number of new lines to reach the offset plus the length of the source correspondent)
      java.io.File getFile()
      Returns a File object representing the source file location of this correspondent
      int getLength()
      Returns the length from the beginning file character offset into the source file for this source correspondent
      static FormattedSourceCorrespondence.LineNumberRange getLineNumberRange​(com.ensoftcorp.atlas.core.index.common.SourceCorrespondence sc)
      Gets a line number range for a given source correspondent
      java.lang.String getLineNumbers()
      Returns the condensed line numbers as a string of ranges for the correspondent(s)
      java.lang.String getName()
      Returns this formatted source correspondence name if one was set or null otherwise
      int getOffset()
      Returns the beginning file character offset into the source file for this source correspondent
      java.lang.String getProject()
      Returns the String of the Eclipse project name containing this correspondent
      java.lang.String getRelativeFile()
      Returns a relative file path string starting at the Eclipse project to the source file that contains this correspondent
      static FormattedSourceCorrespondence getSourceCorrespondent​(com.ensoftcorp.atlas.core.db.graph.GraphElement ge)
      Returns a formatted source correspondent given a GraphElement Returns null if no source correspondents are found.
      static java.util.Collection<FormattedSourceCorrespondence> getSourceCorrespondents​(com.ensoftcorp.atlas.core.query.Q q)
      Returns a collection of source correspondents given a Q
      long getStartLineNumber()
      Returns the source file starting line number (the number of new lines to reach the offset of the source correspondent)
      boolean hasName()
      Returns true if this formatted source correspondence was given a name
      static java.util.Map<java.io.File,​java.util.SortedSet<FormattedSourceCorrespondence.LineNumberRange>> summarize​(com.ensoftcorp.atlas.core.query.Q q)
      Given a Q gets the mapping of relative files to the line number ranges for each summarized element of
      static java.lang.String summarize​(com.ensoftcorp.atlas.core.query.Q q, boolean includeFunctionNames)
      Given a Q, creates a pretty print summary the source graph element locations, line number ranges, and names of graph elements that were functions (if enabled) of
      java.lang.String toString()
      Returns a pretty print string of the format: "Filename: + (line(s) )"
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Method Detail

      • hasName

        public boolean hasName()
        Returns true if this formatted source correspondence was given a name
        Returns:
      • getName

        public java.lang.String getName()
        Returns this formatted source correspondence name if one was set or null otherwise
        Returns:
      • getProject

        public java.lang.String getProject()
        Returns the String of the Eclipse project name containing this correspondent
        Returns:
      • getFile

        public java.io.File getFile()
        Returns a File object representing the source file location of this correspondent
        Returns:
      • getRelativeFile

        public java.lang.String getRelativeFile()
                                         throws java.io.IOException
        Returns a relative file path string starting at the Eclipse project to the source file that contains this correspondent
        Returns:
        Throws:
        java.io.IOException
      • getStartLineNumber

        public long getStartLineNumber()
                                throws java.io.IOException
        Returns the source file starting line number (the number of new lines to reach the offset of the source correspondent)
        Returns:
        Throws:
        java.io.IOException
      • getEndLineNumber

        public long getEndLineNumber()
                              throws java.io.IOException
        Returns the source file ending line number (the number of new lines to reach the offset plus the length of the source correspondent)
        Returns:
        Throws:
        java.io.IOException
      • getLineNumbers

        public java.lang.String getLineNumbers()
                                        throws java.io.IOException
        Returns the condensed line numbers as a string of ranges for the correspondent(s)
        Returns:
        Throws:
        java.io.IOException
      • toString

        public java.lang.String toString()
        Returns a pretty print string of the format: "Filename: + (line(s) )"
        Overrides:
        toString in class java.lang.Object
      • getOffset

        public int getOffset()
        Returns the beginning file character offset into the source file for this source correspondent
        Returns:
      • getLength

        public int getLength()
        Returns the length from the beginning file character offset into the source file for this source correspondent
        Returns:
      • getLineNumberRange

        public static FormattedSourceCorrespondence.LineNumberRange getLineNumberRange​(com.ensoftcorp.atlas.core.index.common.SourceCorrespondence sc)
                                                                                throws java.io.IOException
        Gets a line number range for a given source correspondent
        Parameters:
        sc -
        Returns:
        Throws:
        java.io.IOException
      • getSourceCorrespondents

        public static java.util.Collection<FormattedSourceCorrespondence> getSourceCorrespondents​(com.ensoftcorp.atlas.core.query.Q q)
        Returns a collection of source correspondents given a Q
        Parameters:
        q -
        Returns:
      • getSourceCorrespondent

        public static FormattedSourceCorrespondence getSourceCorrespondent​(com.ensoftcorp.atlas.core.db.graph.GraphElement ge)
        Returns a formatted source correspondent given a GraphElement Returns null if no source correspondents are found.
        Parameters:
        ge -
        Returns:
      • summarize

        public static java.lang.String summarize​(com.ensoftcorp.atlas.core.query.Q q,
                                                 boolean includeFunctionNames)
                                          throws java.io.IOException
        Given a Q, creates a pretty print summary the source graph element locations, line number ranges, and names of graph elements that were functions (if enabled) of
        Parameters:
        q -
        Returns:
        Throws:
        java.io.IOException
      • summarize

        public static java.util.Map<java.io.File,​java.util.SortedSet<FormattedSourceCorrespondence.LineNumberRange>> summarize​(com.ensoftcorp.atlas.core.query.Q q)
                                                                                                                              throws java.io.IOException
        Given a Q gets the mapping of relative files to the line number ranges for each summarized element of
        Parameters:
        q -
        Returns:
        Throws:
        java.io.IOException