org.problets.domain.knowledge
Class KnowledgeUnit

java.lang.Object
  extended by org.problets.domain.knowledge.KnowledgeUnit
All Implemented Interfaces:
java.lang.Cloneable, StatusProvider, GradeConstants

public class KnowledgeUnit
extends java.lang.Object
implements java.lang.Cloneable, StatusProvider, GradeConstants

KnowledgeUnit Class holds information about one knowledge unit

Author:
Amruth Kumar

Field Summary
static java.lang.String DEFAULT_EXPLANATION
           
static java.lang.String DESCRIPTION_PREFIX
           
static double DIVISOR_CORRECT
           
static java.lang.String EXPLN_PREFIX
           
static java.lang.String FEEDBACK_PREFIX
           
static java.lang.String FILENAME_PREFIX
           
static java.lang.String MULTIPLE_WORD_PREFIX
           
static java.lang.String NUM_PREFIX
           
static java.lang.String STATS_HEADER
           
static java.lang.String XML_CONCEPT_DELIMITER
           
 
Fields inherited from interface org.problets.tutor.GradeConstants
CORRECT, GENERATED, gradeText, INCORRECT, MISSED, PARTIAL, TOTAL_STATS, UNATTEMPTED
 
Constructor Summary
KnowledgeUnit(KnowledgeUnit inParent, java.lang.String inContent)
           
KnowledgeUnit(KnowledgeUnit inParent, java.util.Vector knowledgeTaxonomy)
          Constructor to be used when the knowledge model is built recursively based on the template text file.
 
Method Summary
 KnowledgeUnit cleanClone()
          This method returns a clone, whose variables generated, correct, partial, incorrect, missed are initialized to zero
 java.lang.Object clone()
          Method makes a deep copy of content (String) and children (
 KnowledgeUnit getChild(java.util.Vector contentVector)
          Returns a reference to the descendant corresponding to the contents of the vector
 java.util.Vector getChildren()
          Returns a reference to the vector holding all the children of this node
 void getConceptExplanationPairs(java.lang.String learnObjSoFar, java.util.Vector explanationList, boolean leafOnly)
          Recursively returns attribute-value pairs of all concepts and their explanations
 java.lang.String getContent()
           
 java.lang.String getCountString()
          Returns a string of generated/correct/partial/incorrect/missed/unattempted
 java.lang.String getExplanation()
           
 void getLeafNodes(java.util.Vector leafVector)
          Returns reference to ALL the leaf nodes of this node
 void getLeafNodes(java.util.Vector leafVector, java.lang.String learnObjSoFar, java.util.Vector desiredConcepts)
          Returns all the leaf nodes that are also in the (subtree of an element in) desired concepts list.
 java.lang.String getLearningObjective()
          Returns the learning objective for this node, which is a dot composition of the contents of this node with those of all the ancestors up to the root
 KnowledgeUnit getParent()
          Returns a reference to the parent of this knowledge unit
 double getPercentCompletion()
          Returns the percentage completion of this KnowledgeUnit - Needed to implement StatusProvider interface
 int[] getStats()
          Returns an array of the counts for this knowledge unit
 void incrementCount(int gradeType)
          Increments the specified problemCount
 boolean learningObjectiveDone(KnowledgeUnit standard)
          Method returns if this knowledge unit has not yet met the goals set in standard unit.
static void main(java.lang.String[] args)
           
 void printKnowledgeUnit(java.lang.String inPrefix)
           
 void recursiveResetAllCounts()
          Initializes generated, correct, partial, incorrect, missed variables to zero for not only this knowledge unit, but all its descendants
 void resetAllCounts()
          Initializes generated, correct, partial, incorrect, missed variables to zero
 void setCounts(int[] input)
          Sets the number of problems to be solved and minimum percentage correct
 void setParent(KnowledgeUnit inParent)
          Returns the text version of each grading option Moved to GradeConstants as an array public static String gradeText( int gradeNum ) { String result = ""; switch( gradeNum ) { case GENERATED: result = "Generated"; break; case CORRECT: result = "Correct"; break; case PARTIAL: result = "Partial"; break; case INCORRECT: result = "Incorrect"; break; case MISSED: result = "Missed"; break; case UNATTEMPTED: result = "Unattempted"; break; default: result = "Unknown!"; break; } return result; }
 java.lang.String toString()
           
 java.lang.String toXMLString()
          Returns the structure of the knowledge model in XML format
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

STATS_HEADER

public static final java.lang.String STATS_HEADER
See Also:
Constant Field Values

DIVISOR_CORRECT

public static final double DIVISOR_CORRECT
See Also:
Constant Field Values

DEFAULT_EXPLANATION

public static final java.lang.String DEFAULT_EXPLANATION
See Also:
Constant Field Values

NUM_PREFIX

public static final java.lang.String NUM_PREFIX
See Also:
Constant Field Values

EXPLN_PREFIX

public static final java.lang.String EXPLN_PREFIX
See Also:
Constant Field Values

MULTIPLE_WORD_PREFIX

public static final java.lang.String MULTIPLE_WORD_PREFIX
See Also:
Constant Field Values

DESCRIPTION_PREFIX

public static final java.lang.String DESCRIPTION_PREFIX
See Also:
Constant Field Values

FILENAME_PREFIX

public static final java.lang.String FILENAME_PREFIX
See Also:
Constant Field Values

FEEDBACK_PREFIX

public static final java.lang.String FEEDBACK_PREFIX
See Also:
Constant Field Values

XML_CONCEPT_DELIMITER

public static final java.lang.String XML_CONCEPT_DELIMITER
See Also:
Constant Field Values
Constructor Detail

KnowledgeUnit

public KnowledgeUnit(KnowledgeUnit inParent,
                     java.lang.String inContent)

KnowledgeUnit

public KnowledgeUnit(KnowledgeUnit inParent,
                     java.util.Vector knowledgeTaxonomy)
Constructor to be used when the knowledge model is built recursively based on the template text file.

Parameters:
inParent - Reference to the parent Knowledge Unit
KnowledgeTaxonomy - Vector that holds the template for knowledge model, and will be destructively read from by this constructor.
Method Detail

learningObjectiveDone

public boolean learningObjectiveDone(KnowledgeUnit standard)
Method returns if this knowledge unit has not yet met the goals set in standard unit. This method should always be called with student KU, and standard KU should be passed as parameterK. In the future, might think of alternative ways to compare two KUs.


getPercentCompletion

public double getPercentCompletion()
Returns the percentage completion of this KnowledgeUnit - Needed to implement StatusProvider interface

Specified by:
getPercentCompletion in interface StatusProvider

getContent

public java.lang.String getContent()
Specified by:
getContent in interface StatusProvider

getChildren

public java.util.Vector getChildren()
Returns a reference to the vector holding all the children of this node

Specified by:
getChildren in interface StatusProvider

getExplanation

public java.lang.String getExplanation()

getConceptExplanationPairs

public void getConceptExplanationPairs(java.lang.String learnObjSoFar,
                                       java.util.Vector explanationList,
                                       boolean leafOnly)
Recursively returns attribute-value pairs of all concepts and their explanations


clone

public java.lang.Object clone()
Method makes a deep copy of content (String) and children (

Overrides:
clone in class java.lang.Object

cleanClone

public KnowledgeUnit cleanClone()
This method returns a clone, whose variables generated, correct, partial, incorrect, missed are initialized to zero


getLeafNodes

public void getLeafNodes(java.util.Vector leafVector)
Returns reference to ALL the leaf nodes of this node


getLeafNodes

public void getLeafNodes(java.util.Vector leafVector,
                         java.lang.String learnObjSoFar,
                         java.util.Vector desiredConcepts)
Returns all the leaf nodes that are also in the (subtree of an element in) desired concepts list. Concepts could be: (a) Precedence - this helps pull up all Precedence nodes of all operators - to implement aspect-oriented programming (b) *.Precedence - this pulls up only multiplication's precedence and not also that of say / or % In order to disambiguate, it compares the fully qualified objective of the current node to see if it ends in any of the desiredConcepts. E.g., Arithmetic.*.Precedence against either Precedence or *.Precedence in desiredConcepts. ASSUMES THAT the strings in desiredConcepts are in all LOWERCASE, trimmed


getLearningObjective

public java.lang.String getLearningObjective()
Returns the learning objective for this node, which is a dot composition of the contents of this node with those of all the ancestors up to the root


getParent

public KnowledgeUnit getParent()
Returns a reference to the parent of this knowledge unit


getCountString

public java.lang.String getCountString()
Returns a string of generated/correct/partial/incorrect/missed/unattempted


getStats

public int[] getStats()
Returns an array of the counts for this knowledge unit


getChild

public KnowledgeUnit getChild(java.util.Vector contentVector)
Returns a reference to the descendant corresponding to the contents of the vector


setParent

public void setParent(KnowledgeUnit inParent)
Returns the text version of each grading option Moved to GradeConstants as an array public static String gradeText( int gradeNum ) { String result = ""; switch( gradeNum ) { case GENERATED: result = "Generated"; break; case CORRECT: result = "Correct"; break; case PARTIAL: result = "Partial"; break; case INCORRECT: result = "Incorrect"; break; case MISSED: result = "Missed"; break; case UNATTEMPTED: result = "Unattempted"; break; default: result = "Unknown!"; break; } return result; }


resetAllCounts

public void resetAllCounts()
Initializes generated, correct, partial, incorrect, missed variables to zero


recursiveResetAllCounts

public void recursiveResetAllCounts()
Initializes generated, correct, partial, incorrect, missed variables to zero for not only this knowledge unit, but all its descendants


incrementCount

public void incrementCount(int gradeType)
Increments the specified problemCount


setCounts

public void setCounts(int[] input)
Sets the number of problems to be solved and minimum percentage correct


main

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

printKnowledgeUnit

public void printKnowledgeUnit(java.lang.String inPrefix)

toString

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

toXMLString

public java.lang.String toXMLString()
Returns the structure of the knowledge model in XML format