frysk.dom
Class DOMLine

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

public class DOMLine
extends Object

DOMLine represents a line of code (not assembly instruction) in a file.


Field Summary
static String EXECUTABLE_ATTR
          Whether this line is executable or not
static String HAS_BREAK_ATTR
          Whether this line has inlined code or not
static String LENGTH_ATTR
          The length of the line including the \n
static String LINE_NODE
          The name of the Element node
private  Element myElement
           
static String NUMBER_ATTR
          The number of this line
static String OFFSET_ATTR
          The offset in characters from the start of the file
 
Constructor Summary
DOMLine(Element data)
          Creates a new DOMLine using the given data as it's element.
DOMLine(int lineNo, String lineText, int offset, boolean executable, boolean hasBreakpoint, long address)
          Creates a new DOMLine
 
Method Summary
 void addTag(DOMTag tag)
          add a tag element to this line
 void addTag(String type, String token, int start)
          adds a new tag to a source line
 long getAddress()
           
protected  Element getElement()
          get the JDOM Element of this line
 int getLength()
          gets the length of this line in characters
 int getLineNum()
          gets the lines niumber within the source file of this line
 int getOffset()
          gets the offset in characters of this line from the start of the source file
 DOMTag getTag(int index)
          Returns the tag at the given index of the line.
 Iterator getTags()
          get an iterator to all of the tags contained on this line of code
 Iterator getTags(String type)
          Tries to find all the tags on this line of a given type
 String getText()
          get the text associated with this line
 boolean hasBreakPoint()
          Check to see if this line has a breakpoint active
 boolean hasInlinedCode()
          return a boolean indicating whether or not this line contains an inline function
private static String insertCode(String line, String code, int pos)
          insertCode inserts the code sent to it to replace the single char
private static String insertXMLCode(String line)
          inserXMLCode takes a special control character and inserts the XML code for that char.
 boolean isExecutable()
          return a boolean indicating whether or not this line is executable
 void setBreakPoint(boolean hasbreak)
          Set the hasBreak attribute(indicates that this line has a breakpoint set)
 void setExecutable(boolean executable)
          sets the executable attribute for this line
 void setOffset(int offset)
          sets the offset of the line from the beginning of the file
 void setText(String text)
          set the text for this line to the incoming string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EXECUTABLE_ATTR

public static final String EXECUTABLE_ATTR
Whether this line is executable or not

See Also:
Constant Field Values

HAS_BREAK_ATTR

public static final String HAS_BREAK_ATTR
Whether this line has inlined code or not

See Also:
Constant Field Values

OFFSET_ATTR

public static final String OFFSET_ATTR
The offset in characters from the start of the file

See Also:
Constant Field Values

LENGTH_ATTR

public static final String LENGTH_ATTR
The length of the line including the \n

See Also:
Constant Field Values

LINE_NODE

public static final String LINE_NODE
The name of the Element node

See Also:
Constant Field Values

NUMBER_ATTR

public static final String NUMBER_ATTR
The number of this line

See Also:
Constant Field Values

myElement

private Element myElement
Constructor Detail

DOMLine

public DOMLine(int lineNo,
               String lineText,
               int offset,
               boolean executable,
               boolean hasBreakpoint,
               long address)
Creates a new DOMLine

Parameters:
lineNo - The line number of this line
lineText - The text on this line
offset - The offset in characters from the start of the file
executable - Whether this line is executable or not
hasBreakpoint - Whether this line has any breakpoints on it or not
address - The program counter value.

DOMLine

public DOMLine(Element data)
Creates a new DOMLine using the given data as it's element. data must be a node with name "line".

Parameters:
data - is a JDOM element named "line"
Method Detail

getLineNum

public int getLineNum()
gets the lines niumber within the source file of this line

Returns:
The number of this line

getLength

public int getLength()
gets the length of this line in characters

Returns:
The length of this line in characters

getOffset

public int getOffset()
gets the offset in characters of this line from the start of the source file

Returns:
The offset of this line from the start of the file in characters

setOffset

public void setOffset(int offset)
sets the offset of the line from the beginning of the file

Parameters:
character - offset from the beginning of the file

hasInlinedCode

public boolean hasInlinedCode()
return a boolean indicating whether or not this line contains an inline function

Returns:
Whether or not this line contains inlined code

isExecutable

public boolean isExecutable()
return a boolean indicating whether or not this line is executable

Returns:
whether or not this line is executable

setExecutable

public void setExecutable(boolean executable)
sets the executable attribute for this line

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

hasBreakPoint

public boolean hasBreakPoint()
Check to see if this line has a breakpoint active

Returns:
true if there is a breakpoint set here, false if not

setBreakPoint

public void setBreakPoint(boolean hasbreak)
Set the hasBreak attribute(indicates that this line has a breakpoint set)

Parameters:
hasbreak - is the boolean value to set the hasbreak value to

getText

public String getText()
get the text associated with this line

Returns:
the text of this line

setText

public void setText(String text)
set the text for this line to the incoming string

Parameters:
text - is the text of the source line

getTags

public Iterator getTags()
get an iterator to all of the tags contained on this line of code

Returns:
An iterator to all the of tags contained on this line of code

addTag

public void addTag(String type,
                   String token,
                   int start)
adds a new tag to a source line

Parameters:
type - - the type of tag(keyword, variable, function)
token - - token associated with this tag
start - - the starting character within the line

getTags

public Iterator getTags(String type)
Tries to find all the tags on this line of a given type

Parameters:
type - The type of tag to look for
Returns:
An iterator to all the tags of that type on the line

getTag

public DOMTag getTag(int index)
Returns the tag at the given index of the line. Index can either be from the start of the file or from the start of the line

Parameters:
index - Offset to look for a tag at
Returns:
The tag (if any) at that position

addTag

public void addTag(DOMTag tag)
add a tag element to this line

Parameters:
tag - is the element to add to this line

getAddress

public long getAddress()

getElement

protected Element getElement()
get the JDOM Element of this line

Returns:
Element associated with this line

insertXMLCode

private static String insertXMLCode(String line)
inserXMLCode takes a special control character and inserts the XML code for that char.

Parameters:
line -
ch -
Returns:

insertCode

private static String insertCode(String line,
                                 String code,
                                 int pos)
insertCode inserts the code sent to it to replace the single char

Parameters:
line - is the String to insert the characters into
XMLcode - is the String to insert
i - is the location in the line String to insert the chars