org.activemath.webapp.evaluators
Class EvaluationTool

java.lang.Object
  extended by org.activemath.webapp.evaluators.EvaluationTool

public class EvaluationTool
extends Object

EvaluatorHelper.java Created: Wed Sep 19 12:49:01 2001


Field Summary
static int EASIER
           
static int HARDER
           
static int SAME
           
protected static Logger thisLogCat
           
 
Constructor Summary
EvaluationTool()
           
 
Method Summary
static int countWordsInItem(String id)
          counts the words in the item with the supplied id
static int countWordsOnPage(List ids)
          Counts all the words on a page containing the items referred to by the supplied ids.
static Map createHash(double d)
           
static String getAbstractness(String id)
          returns the abstractness rating of an item.
static Double getDifficulty(String pid)
           
static String getEventType(String id)
           
static void getExamples(String id)
           
static Vector getExercises(String concept_id)
          fetches ids of examples for the given concept from MBase.
static void getSimilarExamples(String exa_id, int difficulty)
           
static Vector getSimilarExercises(String some_exercise, int difficulty)
          fetches ids of exercises similar to the given one from MBase, with the chosen difficulty rating.
static String getType(String id)
          returns the type of the given id if it can be retrived.
static String makeCanonical(String in)
          gets a Canonical ID from MBase.
static String timeRating(long duration, String id, int wordsInPage)
          Compares the reading the time observed with the average required reading time, and returns wether the time was "short", "ok" or "long".
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HARDER

public static final int HARDER
See Also:
Constant Field Values

SAME

public static final int SAME
See Also:
Constant Field Values

EASIER

public static final int EASIER
See Also:
Constant Field Values

thisLogCat

protected static Logger thisLogCat
Constructor Detail

EvaluationTool

public EvaluationTool()
Method Detail

getType

public static String getType(String id)
returns the type of the given id if it can be retrived.

Parameters:
id - the id of the item to get the type of.
Returns:
the type of the given id, or null if it can't be retrieved.

getEventType

public static String getEventType(String id)

makeCanonical

public static String makeCanonical(String in)
gets a Canonical ID from MBase. If the id is already canonical, it is returned as is.

Parameters:
in - the id th canonicalize
Returns:
canonical form of in

timeRating

public static String timeRating(long duration,
                                String id,
                                int wordsInPage)
Compares the reading the time observed with the average required reading time, and returns wether the time was "short", "ok" or "long".

Parameters:
duration - the long representation of the Date when the student started acting.
id - the id of the active concept.
wordsInPage - number of words on the whole page
Returns:
  • "short" if the time spent was too short
  • "ok" if the time spent was near the expected time
  • "long" if the time spent quite above the expected time.

countWordsInItem

public static int countWordsInItem(String id)
counts the words in the item with the supplied id

Parameters:
id - the id of the item to cpount the words of
Returns:
the number of words in the given item.

countWordsOnPage

public static int countWordsOnPage(List ids)
Counts all the words on a page containing the items referred to by the supplied ids.

Parameters:
ids - list of item ids to count the words of
Returns:
the number of words in all given items.

getDifficulty

public static Double getDifficulty(String pid)

getAbstractness

public static String getAbstractness(String id)
returns the abstractness rating of an item. It can be one of abstract ,neutral or dummy

Parameters:
id - the id of the item to get the abstractness rating for
Returns:
the abstractness rating of the given item

getExercises

public static Vector getExercises(String concept_id)
fetches ids of examples for the given concept from MBase.
This method queries MBase for all items are related to the supplied one, and then returns those that are exercises.
Not Implemented Yet

Parameters:
concept_id - the id of the concept to get exercises for
Returns:
a Vector of exercises for the supplied concept

getSimilarExercises

public static Vector getSimilarExercises(String some_exercise,
                                         int difficulty)
fetches ids of exercises similar to the given one from MBase, with the chosen difficulty rating.
If there is a SIMILAR metadatum in the supplied exercise, it will return the ids it contains. Otherwise, it gets the id of the concept the exercise was for, then gets all exercises for this concept, and finally filters out the ids of exercises with undesired difficulty rating.

Parameters:
some_exercise - the id of the exercise for which to find a similar one
difficulty - the difficulty rating, one of the constants HARDER, SAME or EASIER
Returns:
the ids of corresponding exercises, or the empty Vector if there were none.

getExamples

public static void getExamples(String id)

getSimilarExamples

public static void getSimilarExamples(String exa_id,
                                      int difficulty)

createHash

public static Map createHash(double d)