Class FormattedSourceCorrespondence
- java.lang.Object
- 
- com.ensoftcorp.open.commons.utilities.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
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classFormattedSourceCorrespondence.LineNumberRange
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(FormattedSourceCorrespondence fsc)longgetEndLineNumber()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.FilegetFile()Returns a File object representing the source file location of this correspondentintgetLength()Returns the length from the beginning file character offset into the source file for this source correspondentstatic FormattedSourceCorrespondence.LineNumberRangegetLineNumberRange(com.ensoftcorp.atlas.core.index.common.SourceCorrespondence sc)Gets a line number range for a given source correspondentjava.lang.StringgetLineNumbers()Returns the condensed line numbers as a string of ranges for the correspondent(s)java.lang.StringgetName()Returns this formatted source correspondence name if one was set or null otherwiseintgetOffset()Returns the beginning file character offset into the source file for this source correspondentjava.lang.StringgetProject()Returns the String of the Eclipse project name containing this correspondentjava.lang.StringgetRelativeFile()Returns a relative file path string starting at the Eclipse project to the source file that contains this correspondentstatic FormattedSourceCorrespondencegetSourceCorrespondent(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 QlonggetStartLineNumber()Returns the source file starting line number (the number of new lines to reach the offset of the source correspondent)booleanhasName()Returns true if this formatted source correspondence was given a namestatic 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 ofstatic java.lang.Stringsummarize(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) ofjava.lang.StringtoString()Returns a pretty print string of the format: "Filename:+ (line(s) )" 
 
- 
- 
- 
Method Detail- 
hasNamepublic boolean hasName() Returns true if this formatted source correspondence was given a name- Returns:
 
 - 
getNamepublic java.lang.String getName() Returns this formatted source correspondence name if one was set or null otherwise- Returns:
 
 - 
getProjectpublic java.lang.String getProject() Returns the String of the Eclipse project name containing this correspondent- Returns:
 
 - 
getFilepublic java.io.File getFile() Returns a File object representing the source file location of this correspondent- Returns:
 
 - 
getRelativeFilepublic java.lang.String getRelativeFile() throws java.io.IOExceptionReturns a relative file path string starting at the Eclipse project to the source file that contains this correspondent- Returns:
- Throws:
- java.io.IOException
 
 - 
getStartLineNumberpublic long getStartLineNumber() throws java.io.IOExceptionReturns the source file starting line number (the number of new lines to reach the offset of the source correspondent)- Returns:
- Throws:
- java.io.IOException
 
 - 
getEndLineNumberpublic long getEndLineNumber() throws java.io.IOExceptionReturns 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
 
 - 
getLineNumberspublic java.lang.String getLineNumbers() throws java.io.IOExceptionReturns the condensed line numbers as a string of ranges for the correspondent(s)- Returns:
- Throws:
- java.io.IOException
 
 - 
toStringpublic java.lang.String toString() Returns a pretty print string of the format: "Filename:+ (line(s) )" - Overrides:
- toStringin class- java.lang.Object
 
 - 
getOffsetpublic int getOffset() Returns the beginning file character offset into the source file for this source correspondent- Returns:
 
 - 
getLengthpublic int getLength() Returns the length from the beginning file character offset into the source file for this source correspondent- Returns:
 
 - 
getLineNumberRangepublic 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
 
 - 
compareTopublic int compareTo(FormattedSourceCorrespondence fsc) - Specified by:
- compareToin interface- java.lang.Comparable<FormattedSourceCorrespondence>
 
 - 
getSourceCorrespondentspublic 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:
 
 - 
getSourceCorrespondentpublic 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:
 
 - 
summarizepublic static java.lang.String summarize(com.ensoftcorp.atlas.core.query.Q q, boolean includeFunctionNames) throws java.io.IOExceptionGiven 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
 
 - 
summarizepublic 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
 
 
- 
 
-