org.problets.domain.view.code.synthesis
Class SynthesisCodeSegment

java.lang.Object
  extended by org.problets.domain.view.code.synthesis.SynthesisCodeSegment

public class SynthesisCodeSegment
extends java.lang.Object

Holds one segment of code: instructions to be displayed, correct code, template, and a stack that holds the student's attempts at answering the code segment

Since:
2 / 15 / 2008
Author:
Amruth Kumar

Constructor Summary
SynthesisCodeSegment(java.lang.String synthesizedCode, int inLineNumber, DomainModel inSource)
           
 
Method Summary
 void addStudentAnswer(java.lang.String studentAnswer)
          Add a new student attempt
 java.util.Vector getAllStudentAttempts()
          Returns the list of all the previous attempts in the order they were attempted
 java.lang.String getInstructions()
          Returns the instructions for this code segment
 java.lang.String getStudentAnswer()
          Returns the latest student attempt
 CodeSegmentAttempt getStudentAttempt()
           
 boolean hasAttempted()
          Returns whether the student has attempted to answer
 boolean isAnswerCorrect()
          Returns whether this answer is correct or not
static void main(java.lang.String[] args)
           
 void print()
           
 void setCorrect()
          Sets that this answer is correct
 void setIncorrect()
          Sets this answer as incorrect
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SynthesisCodeSegment

public SynthesisCodeSegment(java.lang.String synthesizedCode,
                            int inLineNumber,
                            DomainModel inSource)
Parameters:
synthesizedCode - is of the format ^Instructions^Actual Code^Template^
Method Detail

getAllStudentAttempts

public java.util.Vector getAllStudentAttempts()
Returns the list of all the previous attempts in the order they were attempted


getStudentAnswer

public java.lang.String getStudentAnswer()
Returns the latest student attempt


hasAttempted

public boolean hasAttempted()
Returns whether the student has attempted to answer


getInstructions

public java.lang.String getInstructions()
Returns the instructions for this code segment


getStudentAttempt

public CodeSegmentAttempt getStudentAttempt()

isAnswerCorrect

public boolean isAnswerCorrect()
Returns whether this answer is correct or not


setCorrect

public void setCorrect()
Sets that this answer is correct


setIncorrect

public void setIncorrect()
Sets this answer as incorrect


addStudentAnswer

public void addStudentAnswer(java.lang.String studentAnswer)
Add a new student attempt


print

public void print()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

main

public static void main(java.lang.String[] args)