net.sourceforge.jsurveyor
Class Report

java.lang.Object
  extended bynet.sourceforge.jsurveyor.Report

public class Report
extends java.lang.Object

This class is made for containing and calculating on the evaluations that users write in. It's only input is a questionnaireID where the rest is taking from the database, and it is used by ReportOutput to generate a pdf document. The calculations done in this class is getting the newest evaluations and adding the multiplechoice answers together. There will only be get and creation of the report method in this Class because it's not the idea to change the data that is retrieved from the database.

Version:
1.0
Author:
Claus Methmann Christensen, Anders Spliid Hansen, Esben Iversen Hansen, Lars H Jensen, Marcus Overheu, Thomas Ramdal, Peter Thomsen

Nested Class Summary
 class Report.InnerAnswerFreeText
           
 class Report.InnerAnswerMultipleChoice
          This class contains all the values needed from the MultipleChoiceAnswers, like how the answers are distributed over each choice
 class Report.InnerQuestionFreeText
           
 
Constructor Summary
Report()
          Default Constructor for Report, with no inputs and values
Report(int questionnaireID)
          Constructor for Report, this is the most used constructor for report it takes the questionnaireID as an input for knowing which quesionnaire to take, and calls 2 methods: getEvaluations(questionnaireID) and findTypeOfInnerAnswers()
 
Method Summary
 void cycleFreeTexts(int answerNumber, int evaluationNumber)
          The method retrieves from the database and instantiate a tempAnswer from the evaluation evaluationNumber, where the tempAnswer is at the position answerNumber in the evaluations answers list.
 void cycleMultipleChoices(int answerNumber, int evaluationNumber)
          The method retrieves from the database and instantiate a tempAnswer from the evaluation evaluationNumber, where the tempAnswer is at the position answerNumber in the evaluations answers list.
 void findTypeOfInnerAnswers()
          The method is called after the evaluations are put into order, where it goes through each usable evaluation and finds out which type of answer it contains, which are send to their cyclemethod for their type.
 int getAllEvaluationsSize()
          The method returns the size of the Arraylist allEvaluations that contains the reference to all evaluations taken from the database
 void getEvaluations(int questionnaireID)
          Method getEvaluations, this method runs through all evaluations for that questionnaire and takes out each of them and compares them with the ones already in the ArrayList usableEvaluations.
 java.util.ArrayList getInnerAnswerMultipleChoice()
          The method return the ArrayList innerAnswerMultipleChoice which contains the references to the instances of InnerAnswerMultipleChoice in the report
 int[] getInnerAnswerMultipleChoiceDistribution(int j)
          The method gets the instance of the type InnerAnswerMultipleChoice at the index j in the ArrayLisy innerAnswerMultipleChoice.
 java.lang.String getInnerAnswerMultipleChoiceQuestionText(int j)
          Method getInnerAnswerMultipleChoiceQuestionText
 int getInnerAnswerMultipleChoiceSize()
          The method return the size of the ArrayList
 java.lang.String[] getInnerAnswerMultipleChoiceText(int j)
          The method returns a String Array for a specific InnerAnswerMultipleChoice, where the String contains the text for each choice posibility
 int getInnerAnswerSize(int number)
          The method returns the number of answers to this instance of InnerQuestionFreeText.
 java.lang.String[] getInnerAnswerText(int number)
          The method returns a String Array consisting of all the answers for that instanceOf InnerQuestionFreeText.
 int getInnerFreeTextSize()
          This method returns the size of the Arraylist that contains the references to the objects of the Class.
 java.lang.String getInnerQuestionFreeText(int i)
          The method return the Question text for the instance of InnerQuestionFreeText
 int getInnerQuestionFreeTextSize(int i)
          this returns the number of answers for the Question at index i in the ArrayList innerQuestionFreeText.
 java.lang.String[] getInnerUserText(int number)
          The method returns a String Array consisting of all the users for that instanceOf InnerQuestionFreeText.
 java.lang.String getQuestionnaireIntroText()
          The method returns the text that was in the intro in the used questionnaire
 java.lang.String getQuestionnaireName()
          The method returns the name for the questionnaire
 int getUsableEvaluationsSize()
          The method returns the size of the Arraylist usableEvaluations which contains the references to the newest evaluations for each user
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Report

public Report()
Default Constructor for Report, with no inputs and values


Report

public Report(int questionnaireID)
Constructor for Report, this is the most used constructor for report it takes the questionnaireID as an input for knowing which quesionnaire to take, and calls 2 methods: getEvaluations(questionnaireID) and findTypeOfInnerAnswers()

Parameters:
questionnaireID - int
Method Detail

getEvaluations

public void getEvaluations(int questionnaireID)
Method getEvaluations, this method runs through all evaluations for that questionnaire and takes out each of them and compares them with the ones already in the ArrayList usableEvaluations.

Parameters:
questionnaireID - int

findTypeOfInnerAnswers

public void findTypeOfInnerAnswers()
The method is called after the evaluations are put into order, where it goes through each usable evaluation and finds out which type of answer it contains, which are send to their cyclemethod for their type. Method findTypeOfInnerAnswers


getInnerFreeTextSize

public int getInnerFreeTextSize()
This method returns the size of the Arraylist that contains the references to the objects of the Class.

Returns:
int

getQuestionnaireIntroText

public java.lang.String getQuestionnaireIntroText()
The method returns the text that was in the intro in the used questionnaire

Returns:
String

getQuestionnaireName

public java.lang.String getQuestionnaireName()
The method returns the name for the questionnaire

Returns:
String

getAllEvaluationsSize

public int getAllEvaluationsSize()
The method returns the size of the Arraylist allEvaluations that contains the reference to all evaluations taken from the database

Returns:
int

getUsableEvaluationsSize

public int getUsableEvaluationsSize()
The method returns the size of the Arraylist usableEvaluations which contains the references to the newest evaluations for each user

Returns:
int

getInnerAnswerMultipleChoice

public java.util.ArrayList getInnerAnswerMultipleChoice()
The method return the ArrayList innerAnswerMultipleChoice which contains the references to the instances of InnerAnswerMultipleChoice in the report

Returns:
ArrayList

getInnerAnswerMultipleChoiceSize

public int getInnerAnswerMultipleChoiceSize()
The method return the size of the ArrayList

Returns:
int

getInnerAnswerMultipleChoiceQuestionText

public java.lang.String getInnerAnswerMultipleChoiceQuestionText(int j)
Method getInnerAnswerMultipleChoiceQuestionText

Parameters:
j - int
Returns:
String

getInnerAnswerMultipleChoiceText

public java.lang.String[] getInnerAnswerMultipleChoiceText(int j)
The method returns a String Array for a specific InnerAnswerMultipleChoice, where the String contains the text for each choice posibility

Parameters:
j - int
Returns:
String[]

getInnerAnswerMultipleChoiceDistribution

public int[] getInnerAnswerMultipleChoiceDistribution(int j)
The method gets the instance of the type InnerAnswerMultipleChoice at the index j in the ArrayLisy innerAnswerMultipleChoice.

Parameters:
j - int
Returns:
int[]

cycleMultipleChoices

public void cycleMultipleChoices(int answerNumber,
                                 int evaluationNumber)
The method retrieves from the database and instantiate a tempAnswer from the evaluation evaluationNumber, where the tempAnswer is at the position answerNumber in the evaluations answers list. After that it cycles the InnerMultipleChoiceAnswers to find out if one of the same type is there and adds it's distribution to it or creates a new InnerMultipleChoiceAnswer if there isn't anyone of the same type. The type of the answer is questionID specific they are equal if they have the same questionID.

Parameters:
answerNumber - int
evaluationNumber - int

cycleFreeTexts

public void cycleFreeTexts(int answerNumber,
                           int evaluationNumber)
The method retrieves from the database and instantiate a tempAnswer from the evaluation evaluationNumber, where the tempAnswer is at the position answerNumber in the evaluations answers list. Then it cycles the InnerQuestionFreeText comparing if the question exist in the ArrayList innerQuestionFreeText, adding it if it doesn't with the respective answer or adds the answer if the question exist.

Parameters:
answerNumber - int
evaluationNumber - int

getInnerQuestionFreeTextSize

public int getInnerQuestionFreeTextSize(int i)
this returns the number of answers for the Question at index i in the ArrayList innerQuestionFreeText.

Parameters:
i - int
Returns:
int

getInnerQuestionFreeText

public java.lang.String getInnerQuestionFreeText(int i)
The method return the Question text for the instance of InnerQuestionFreeText

Parameters:
i - int
Returns:
String

getInnerAnswerSize

public int getInnerAnswerSize(int number)
The method returns the number of answers to this instance of InnerQuestionFreeText.

Parameters:
number - int
Returns:
int

getInnerAnswerText

public java.lang.String[] getInnerAnswerText(int number)
The method returns a String Array consisting of all the answers for that instanceOf InnerQuestionFreeText.

Parameters:
number - int
Returns:
String[]

getInnerUserText

public java.lang.String[] getInnerUserText(int number)
The method returns a String Array consisting of all the users for that instanceOf InnerQuestionFreeText.

Parameters:
number - int
Returns:
String[]