org.problets.domain.line
Class CodeLine

java.lang.Object
  extended by org.problets.domain.line.AbstractLine
      extended by org.problets.domain.line.CodeLine
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
SynthesisCodeLine

public class CodeLine
extends AbstractLine
implements java.lang.Cloneable

CodeLine class maintains one line of code.

Author:
Amruth Kumar

Field Summary
 
Fields inherited from class org.problets.domain.line.AbstractLine
UNASSIGNED_LINE
 
Constructor Summary
CodeLine()
           
CodeLine(java.lang.String inLineCode, java.lang.String inLineTemplate, int inLineNumber, DomainModel source)
           
 
Method Summary
 void addPrefix(java.lang.String prefix)
          Method to add a prefix to the code
 void addtoLineObjects(java.lang.Object parameter)
          Method to add a new object to the lineObjects vector - avoids duplicates
 void addtoLineObjects(java.util.Vector inLineObjects)
          Method to add several objects to the lineObjects vector - avoids duplicates
 java.lang.Object clone()
          Method makes a copy of the CodeLine's various data members
static void decrementIndentation()
          Decrement the amount of indentation for subsequent lines of code
 void draw(java.awt.Graphics g, int xStart, int xIndent, int yCoord)
           
 int getIndentation()
          Returns the amount of indentation of this line
 java.lang.String getLineCode()
           
 java.util.Vector getLineObjects()
          Method to return a reference to the list of domain objects involved in this line.
 java.lang.String getLineTemplate()
           
 DomainModel getSource()
          Returns a reference to the source of this line of code
static void incrementIndentation()
          Increment the amount of indentation for subsequent lines of code
static void initializeIndentation()
          Initializes the current indentation to 1
 boolean isOutputStatement()
          Returns whether this is an output statement
 void print()
          Implemnts a base class method Prints all the fields of the class
 void setCode(java.lang.String inLineCode)
          Method to revise the code - used to revise the code for closing brace in most control constructs
 void setIndentation(int inIndentation)
          Change the level of indentation of this line - used by reordering/refactoring problems
 java.lang.String toString()
          Implementing method of the abstract base class so that LogModel.addToLog() works correctly Returns only that which is entered into the log
 
Methods inherited from class org.problets.domain.line.AbstractLine
getLineNumber, setLineNumber
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CodeLine

public CodeLine()

CodeLine

public CodeLine(java.lang.String inLineCode,
                java.lang.String inLineTemplate,
                int inLineNumber,
                DomainModel source)
Method Detail

clone

public java.lang.Object clone()
Method makes a copy of the CodeLine's various data members

Overrides:
clone in class AbstractLine

draw

public void draw(java.awt.Graphics g,
                 int xStart,
                 int xIndent,
                 int yCoord)
Parameters:
xStart - Starting x coordinate for the line
xIndent - Amount by which code should be indented for each level of indentation Method draws the contents of this codeLine object Although this should ideally be in the view class, we are leaving it here since there is little need for a separate view class.

addtoLineObjects

public void addtoLineObjects(java.lang.Object parameter)
Method to add a new object to the lineObjects vector - avoids duplicates


addtoLineObjects

public void addtoLineObjects(java.util.Vector inLineObjects)
Method to add several objects to the lineObjects vector - avoids duplicates


setCode

public void setCode(java.lang.String inLineCode)
Method to revise the code - used to revise the code for closing brace in most control constructs


addPrefix

public void addPrefix(java.lang.String prefix)
Method to add a prefix to the code


incrementIndentation

public static void incrementIndentation()
Increment the amount of indentation for subsequent lines of code


decrementIndentation

public static void decrementIndentation()
Decrement the amount of indentation for subsequent lines of code


setIndentation

public void setIndentation(int inIndentation)
Change the level of indentation of this line - used by reordering/refactoring problems


initializeIndentation

public static void initializeIndentation()
Initializes the current indentation to 1


getLineCode

public java.lang.String getLineCode()

getLineTemplate

public java.lang.String getLineTemplate()

getLineObjects

public java.util.Vector getLineObjects()
Method to return a reference to the list of domain objects involved in this line. The client will addElement to the vector that is returned.


getIndentation

public int getIndentation()
Returns the amount of indentation of this line


isOutputStatement

public boolean isOutputStatement()
Returns whether this is an output statement


getSource

public DomainModel getSource()
Returns a reference to the source of this line of code


toString

public java.lang.String toString()
Implementing method of the abstract base class so that LogModel.addToLog() works correctly Returns only that which is entered into the log

Specified by:
toString in class AbstractLine

print

public void print()
Implemnts a base class method Prints all the fields of the class

Specified by:
print in class AbstractLine