frysk.dom
Class DOMSource

java.lang.Object
  extended by frysk.dom.DOMSource

public class DOMSource
extends Object

DOMSource represents a source code file within the frysk source window dom


Field Summary
static String ADDR_ATTR
           
static String FILENAME_ATTR
          Name of this file
static String FILEPATH_ATTR
          Path to this file
static String INCLUDES
           
static String IS_PARSED
          Whether this source file has already been parsed
static String PARSER_ERROR
          Whether the parser errored out while while this source was being parsed
static String SOURCE_NODE
          Name of this node in the DOM tree
static String TEXT_ATTR
           
 
Constructor Summary
DOMSource(Element data)
          Creates a new DOMSource object with the given data as it's Element.
DOMSource(String filename, String filepath, String[] includepaths)
          Creates a new DOMSource
 
Method Summary
 void addFunction(String inline_name, int startLine, int endLine, int start_offset, int end_offset, String function_call)
          adds an inline function to this DOMSource object.
 void addInlineFunction(DOMFunction function)
          Adds an inline function to this source.
 void addInlineInst(String instance, int start_inline, int length, int PCLine, int line)
          add an inline instance to this source instance.
 void addLine(DOMLine line)
          add a DOMLine element
 void addLine(int lineno, String text, boolean is_executable, boolean has_break, int offset_index, long pc)
          creates a line Element under this source Element
 DOMFunction findFunction(int lineNum)
          Search the functions which are children to this DOMSource to find the DOMFunction which contains the requested line number.
 String getContent()
           
 String getFileName()
          get the name of the source file where this source resides
 String getFilePath()
          get the path to the source file
 DOMFunction getFunction(String name)
          attempts to fetch an inlined function DOM element
 Iterator getFunctions()
           
 String getIncludes()
          get the path to the source file
 Iterator getInlinedFunctions()
          get all of the inlined function declarations in this source file
 DOMInlineInstance getInlineInst(String inst_name)
          get the DOMInlineInstance associated with this instance
 Iterator getInlines(int lineNum)
          gets all of the inline instances attached with the requested line number
 DOMLine getLine(int num)
          Attempts to return the DOMLine corresponding to the given line in the file.
 int getLineCount()
          get the line count for this Source element
 Iterator getLines()
          gets all of the lines in this source file
 DOMLine getLineSpanningOffset(int offset)
          find out which line a given character offset resides is
 boolean getParserError()
          get the parseError value for this source
 boolean isParsed()
          return a boolean indicating whether or not this source has been parsed for marking up
 void setContent(String con)
           
 void setFileName(String name)
          sets the name of the file containing the source
 void setFilePath(String path)
          set the path to the source file for this source element
 void setParsed(boolean value)
          set the isParsed boolean value for this source
 void setParserError(boolean value)
          set the parseError value for this source
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILEPATH_ATTR

public static final String FILEPATH_ATTR
Path to this file

See Also:
Constant Field Values

FILENAME_ATTR

public static final String FILENAME_ATTR
Name of this file

See Also:
Constant Field Values

SOURCE_NODE

public static final String SOURCE_NODE
Name of this node in the DOM tree

See Also:
Constant Field Values

IS_PARSED

public static final String IS_PARSED
Whether this source file has already been parsed

See Also:
Constant Field Values

PARSER_ERROR

public static final String PARSER_ERROR
Whether the parser errored out while while this source was being parsed

See Also:
Constant Field Values

ADDR_ATTR

public static final String ADDR_ATTR
See Also:
Constant Field Values

TEXT_ATTR

public static final String TEXT_ATTR
See Also:
Constant Field Values

INCLUDES

public static final String INCLUDES
See Also:
Constant Field Values
Constructor Detail

DOMSource

public DOMSource(Element data)
Creates a new DOMSource object with the given data as it's Element. data must be a node with name "source"

Parameters:
JDOM - element data

DOMSource

public DOMSource(String filename,
                 String filepath,
                 String[] includepaths)
Creates a new DOMSource

Parameters:
filename - is a String with the name of the file
filepath - is a String with the path to the file
include - paths is a String array with the include paths used to compile this source file
Method Detail

setFileName

public void setFileName(String name)
sets the name of the file containing the source

Parameters:
name - to set the filename to

getLineCount

public int getLineCount()
get the line count for this Source element

Returns:
the line count for this source element

getFileName

public String getFileName()
get the name of the source file where this source resides

Returns:
the name of the file

setFilePath

public void setFilePath(String path)
set the path to the source file for this source element

Parameters:
new - path to set the FILEPATH_ATTR to

getFilePath

public String getFilePath()
get the path to the source file

Returns:
the path to the file

getIncludes

public String getIncludes()
get the path to the source file

Returns:
the path to the file

addFunction

public void addFunction(String inline_name,
                        int startLine,
                        int endLine,
                        int start_offset,
                        int end_offset,
                        String function_call)
adds an inline function to this DOMSource object.

Parameters:
inline_name - is the name of the inline function
source - is the name of the source this function came from
startLine - is the starting line number of this function in the source
endLine - is the ending line number of this function in the source
start_offset - is the starting character offset from the beginning of the file of the first character of the function
end_offset - is the ending character offset from the beginning of the file of the last character of the function

getFunctions

public Iterator getFunctions()
Returns:
An iterator to all functions in this DOMSource

findFunction

public DOMFunction findFunction(int lineNum)
Search the functions which are children to this DOMSource to find the DOMFunction which contains the requested line number.

Parameters:
lineNum - The source line inside the function being searched for.
Returns:
found The DOMFunction found to match lineNum

getFunction

public DOMFunction getFunction(String name)
attempts to fetch an inlined function DOM element

Parameters:
name - of the inlined function to return
Returns:
the DOMImage corresponding to the element, or null if no such element exists

addLine

public void addLine(int lineno,
                    String text,
                    boolean is_executable,
                    boolean has_break,
                    int offset_index,
                    long pc)
creates a line Element under this source Element

Parameters:
lineno - - line number to add
text - - text of the line to add
is_executable - - is this line executable
has_break - - does this line have a breakpoint
offset_index - - character offset of this line from the start of the file
pc(program - counter) for this line

getLines

public Iterator getLines()
gets all of the lines in this source file

Returns:
An iterator over all of the lines in this file

getLine

public DOMLine getLine(int num)
Attempts to return the DOMLine corresponding to the given line in the file. If no tags exist on that line then null is returned. (This is alternative to the above getLineNum() method, if the above is determined to not be necessary, delete it and rename this one to getLine().

Parameters:
num - The line number to get
Returns:
The DOMLine corresponding to the line, or null if no tags exist on that line

getLineSpanningOffset

public DOMLine getLineSpanningOffset(int offset)
find out which line a given character offset resides is

Parameters:
offset - is the character position from the start of the file
Returns:
if found return the DOMLine element, else return null

addLine

public void addLine(DOMLine line)
add a DOMLine element

Parameters:
line - is the DOMLine element to add

addInlineInst

public void addInlineInst(String instance,
                          int start_inline,
                          int length,
                          int PCLine,
                          int line)
add an inline instance to this source instance.

Parameters:
instance - is the name of the instance to add
start_inline - is the starting character of this instance in this line
end_line - is the ending character of this instance in this line

getInlineInst

public DOMInlineInstance getInlineInst(String inst_name)
get the DOMInlineInstance associated with this instance

Parameters:
inst - is the name of the instance to retrieve
Returns:
the DOMInlineInstance of this instance

getInlines

public Iterator getInlines(int lineNum)
gets all of the inline instances attached with the requested line number

Parameters:
lineNum - The line number in the source jumping to the inlined instance.
Returns:
an iterator pointing to all inline instances on this line

getInlinedFunctions

public Iterator getInlinedFunctions()
get all of the inlined function declarations in this source file

Returns:
An iterator to all the inlined function declarations in this source file

addInlineFunction

public void addInlineFunction(DOMFunction function)
Adds an inline function to this source. By convention the inline function declarations are added earlier in the xml schema than the line table

Parameters:
function - The inlined function declaration to add

isParsed

public boolean isParsed()
return a boolean indicating whether or not this source has been parsed for marking up

Returns:
boolean indicating the parsing status

setParsed

public void setParsed(boolean value)
set the isParsed boolean value for this source

Parameters:
value - is the boolean value to set the isParsed attribute to

setParserError

public void setParserError(boolean value)
set the parseError value for this source

Parameters:
value - = true is the parser errored while parsing this source code false if not

getParserError

public boolean getParserError()
get the parseError value for this source


setContent

public void setContent(String con)

getContent

public String getContent()