From: <se...@us...> - 2008-05-20 16:07:14
|
Revision: 149 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=149&view=rev Author: sem62 Date: 2008-05-20 09:06:25 -0700 (Tue, 20 May 2008) Log Message: ----------- Initial import. Added Paths: ----------- RTE/.classpath RTE/.project RTE/src/ RTE/src/Cmi.java Added: RTE/.classpath =================================================================== --- RTE/.classpath (rev 0) +++ RTE/.classpath 2008-05-20 16:06:25 UTC (rev 149) @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="output" path="bin"/> +</classpath> Added: RTE/.project =================================================================== --- RTE/.project (rev 0) +++ RTE/.project 2008-05-20 16:06:25 UTC (rev 149) @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>RTE</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> Added: RTE/src/Cmi.java =================================================================== --- RTE/src/Cmi.java (rev 0) +++ RTE/src/Cmi.java 2008-05-20 16:06:25 UTC (rev 149) @@ -0,0 +1,4 @@ + +public class Cmi { + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <se...@us...> - 2008-05-20 20:25:07
|
Revision: 151 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=151&view=rev Author: sem62 Date: 2008-05-20 13:25:02 -0700 (Tue, 20 May 2008) Log Message: ----------- Extracted this model from webPlayer. Removed AnswersManager because it dosn't working properly at this time. Modified Paths: -------------- RTE/.classpath RTE/src/edu/lnu/FireFly/Rte/Cmi.java Added Paths: ----------- RTE/src/edu/lnu/FireFly/Rte/Activity.java RTE/src/edu/lnu/FireFly/Rte/CmiElement.java RTE/src/edu/lnu/FireFly/Rte/CmiManager.java RTE/src/edu/lnu/FireFly/Rte/GlobalObjectivesManager.java RTE/src/edu/lnu/FireFly/Rte/GlobalStateInformation.java RTE/src/edu/lnu/FireFly/Rte/ObjectiveMap.java RTE/src/edu/lnu/FireFly/Rte/Utils.java RTE/src/edu/lnu/FireFly/Rte/elements/ RTE/src/edu/lnu/FireFly/Rte/elements/AnswersElement.java RTE/src/edu/lnu/FireFly/Rte/elements/CommentsFromLMSElement.java RTE/src/edu/lnu/FireFly/Rte/elements/CommentsFromLearnerElement.java RTE/src/edu/lnu/FireFly/Rte/elements/IElementGetter.java RTE/src/edu/lnu/FireFly/Rte/elements/InteractionsCorrectResponsesElement.java RTE/src/edu/lnu/FireFly/Rte/elements/InteractionsElement.java RTE/src/edu/lnu/FireFly/Rte/elements/InteractionsObjectivesElement.java RTE/src/edu/lnu/FireFly/Rte/elements/LearnerPreferenceElement.java RTE/src/edu/lnu/FireFly/Rte/elements/ObjectivesElement.java RTE/src/edu/lnu/FireFly/Rte/elements/ScoreElement.java Modified: RTE/.classpath =================================================================== --- RTE/.classpath 2008-05-20 17:16:21 UTC (rev 150) +++ RTE/.classpath 2008-05-20 20:25:02 UTC (rev 151) @@ -2,5 +2,7 @@ <classpath> <classpathentry kind="src" path="src"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="lib" path="S:/WebEditor/dom4j.jar"/> + <classpathentry kind="lib" path="S:/WebEditor/FFManifest.jar" sourcepath="S:/WebEditor/FFManifest.jar"/> <classpathentry kind="output" path="bin"/> </classpath> Added: RTE/src/edu/lnu/FireFly/Rte/Activity.java =================================================================== --- RTE/src/edu/lnu/FireFly/Rte/Activity.java (rev 0) +++ RTE/src/edu/lnu/FireFly/Rte/Activity.java 2008-05-20 20:25:02 UTC (rev 151) @@ -0,0 +1,187 @@ +package edu.lnu.FireFly.Rte; + +import java.util.ArrayList; + +import edu.lnu.FireFly.FFManifest.*; +import edu.lnu.FireFly.FFManifest.item.*; +import edu.lnu.FireFly.FFManifest.item.sequencing.*; +import edu.lnu.FireFly.FFManifest.parser.TestDocException; +import edu.lnu.FireFly.FFManifest.resource.*; + +public class Activity { + // from Organization + public String structure; + public boolean objectivesGlobalToSystem; + // from Item + public String identifierref; + public boolean isvisible; + public String parameters; + public String timeLimitAction; + public String dataFromLMS; + public Double completionThreshold; + public Presentation presentation; + // both + public String identifier; + public String title; + public ArrayList<Activity> items; + public String metadata_adlcp_location = ""; + public Sequencing sequencing; + // other + public Activity parent; + public boolean isRoot = false; + private static Activity rootActivity; + + private static Manifest manifest = null; + + public Activity(Manifest manifest, Item item, Activity parentActivity){ + Activity.manifest = manifest; + + copyDataFromItem(item); + + parent = parentActivity; + + items = new ArrayList<Activity>(); + int i; + if (item.items != null){ + for (i = 0; i < item.items.size(); i++){ + items.add(new Activity(manifest, item.items.get(i), this)); + } + } + } + + private void copyDataFromItem(Item item) { + identifierref = item.identifierref; + isvisible = item.isvisible; + parameters = item.parameters; + timeLimitAction = item.timeLimitAction; + dataFromLMS = item.dataFromLMS; + completionThreshold = item.completionThreshold; + presentation = item.presentation; + identifier = item.identifier; + title = item.title; + sequencing = item.sequencing; + } + + public Activity(Manifest manifest, Organization organization){ + Activity.manifest = manifest; + + structure = organization.structure; + objectivesGlobalToSystem = organization.objectivesGlobalToSystem; + identifier = organization.identifier; + title = organization.title; + sequencing = organization.sequencing; + + isRoot = true; + items = new ArrayList<Activity>(); + int i; + for (i = 0; i < organization.items.size(); i++){ + items.add(new Activity(manifest, organization.items.get(i), this)); + } + rootActivity = this; + } + + public static Activity getRoot(){ + return rootActivity; + } + + public static void updateActivitiesStructure(Manifest manifest){ + if (manifest != Activity.manifest){ + fullUpdate(manifest); + + return; + } + + + } + + public static void fullUpdate(Manifest manifest) { + Activity.manifest = manifest; + + try { + new Activity(manifest, (Organization)manifest.organizations.getDefaultOrganization()); + } catch (TestDocException e) { + e.printStackTrace(); + } + } + + public Resource getResource(){ + if (identifierref == null){ + return null; + } + + for (int i=0; i < manifest.resources.resources.size(); i++){ + if (manifest.resources.resources.get(i).identifier.equals(identifierref)){ + return manifest.resources.resources.get(i); + } + } + return null; + } + + public boolean isLeaf(){ + return items.size() == 0; + } + + public int getChildIndex(String id){ + int i; + for (i = 0; i < items.size(); i++){ + if (id.equals(items.get(i).identifier)){ + break; + } + } + return i; + } + + public static Activity findActivityByIdentifier(String identifier){ + return rootActivity.findActivityByIdentifier2(identifier); + } + + public Activity findActivityByIdentifier2(String identifier){ + if (this.identifier.equals(identifier)){ + return this; + } + + for (int i=0; i<items.size(); i++){ + Activity item = items.get(i).findActivityByIdentifier2(identifier); + if (item != null){ + return item; + } + } + return null; + } + + public Activity getLastLeafInCluester(boolean ignoreForvarOnlyControlMode, boolean use_flow_control_mode_attribute){ + + if (isLeaf()){ + return this; + } + + if (!ignoreForvarOnlyControlMode && sequencing.controlMode.forwardOnly){ + return null; + } + + if (use_flow_control_mode_attribute && sequencing.controlMode.flow){ + return items.get(items.size() - 1).getLastLeafInCluester(ignoreForvarOnlyControlMode, use_flow_control_mode_attribute); + } + + return this; + } + + public Activity getFirstLeafInCluester(boolean use_flow_control_mode_attribute){ + if (isLeaf()){ + return this; + } + + if (use_flow_control_mode_attribute){ + } + + if (use_flow_control_mode_attribute && sequencing.controlMode.flow){ + return items.get(0).getFirstLeafInCluester(use_flow_control_mode_attribute); + } else { + return this; + } + } + + public String toString(){ + return title; + } +} Modified: RTE/src/edu/lnu/FireFly/Rte/Cmi.java =================================================================== --- RTE/src/edu/lnu/FireFly/Rte/Cmi.java 2008-05-20 17:16:21 UTC (rev 150) +++ RTE/src/edu/lnu/FireFly/Rte/Cmi.java 2008-05-20 20:25:02 UTC (rev 151) @@ -1,47 +1,276 @@ package edu.lnu.FireFly.Rte; -import java.util.Hashtable; +import java.util.ArrayList; + +import edu.lnu.FireFly.FFManifest.item.sequencing.objectives.Objective; +import edu.lnu.FireFly.Rte.elements.AnswersElement; +import edu.lnu.FireFly.Rte.elements.CommentsFromLMSElement; +import edu.lnu.FireFly.Rte.elements.CommentsFromLearnerElement; +import edu.lnu.FireFly.Rte.elements.InteractionsElement; +import edu.lnu.FireFly.Rte.elements.LearnerPreferenceElement; +import edu.lnu.FireFly.Rte.elements.ObjectivesElement; +import edu.lnu.FireFly.Rte.elements.ScoreElement; + public class Cmi { + private CmiElement _version = new CmiElement("1.0"); + private ArrayList<CommentsFromLearnerElement> commentsFromLearner = new ArrayList<CommentsFromLearnerElement>(); + private ArrayList<CommentsFromLMSElement> commentsFromLMS = new ArrayList<CommentsFromLMSElement>(); + public CmiElement completionStatus = new CmiElement("unknown", new String[]{"completed", "incomplete", "not attempted", "unknown"}); + private CmiElement completionThreshold = new CmiElement(""); + private CmiElement credit = new CmiElement("credit", new String[]{"credit", "no-credit"}); + private CmiElement entry = new CmiElement("ab-initio", new String[]{"ab-initio", "resume", ""}); + private CmiElement exit = new CmiElement("", new String[]{"time-out", "suspend", "logout", "normal", ""}); + private ArrayList<InteractionsElement> interactions = new ArrayList<InteractionsElement>(); + private CmiElement launchData = new CmiElement(""); + private CmiElement learnerId = new CmiElement(""); + private CmiElement learnerName = new CmiElement(""); + private LearnerPreferenceElement learnerPreference = new LearnerPreferenceElement(); + private CmiElement location = new CmiElement(""); + private CmiElement maxTimeAllowed = new CmiElement(""); + private CmiElement mode = new CmiElement("normal", new String[]{"normal", "browse", "review"}); + private ArrayList<ObjectivesElement> objectives = new ArrayList<ObjectivesElement>(); + private CmiElement progressMeasure = new CmiElement(""); + private CmiElement scaledPassingScore = new CmiElement(""); + private ScoreElement score = new ScoreElement(); + private CmiElement sessionTime = new CmiElement(""); + private CmiElement successStatus = new CmiElement("unknown", new String[]{"passed", "failed", "unknown"}); + private CmiElement suspendData = new CmiElement(""); + private CmiElement timeLimitAction = new CmiElement(""); + private CmiElement totalTime = new CmiElement(""); - protected Hashtable<String, String> values = new Hashtable<String, String>(); + public ArrayList<AnswersElement> answers = new ArrayList<AnswersElement>(); - private int state = NOT_INITIALIZED_NOT_TERMINATED; + private ArrayList<CmiElement> queryQueue = new ArrayList<CmiElement>(); + + public Cmi(Activity activity){ + addManifestObjectives(activity); + } - public void Initialize(String param){ - values.clear(); - - initDefaultValues(); - - state = INITIALIZED_NOT_TERMINATED; - } + private void addManifestObjectives(Activity activity){ + if (activity == null || activity.sequencing == null || activity.sequencing.objectives == null){ + return; + } - private void initDefaultValues() { - values.put("cmi.completionStatus", "incomplete"); + Objective primaryObjective = activity.sequencing.objectives.primaryObjective; + ObjectivesElement oe = new ObjectivesElement(); + oe.id.value = primaryObjective.objectiveID; + objectives.add(oe); + if (primaryObjective.mapInfo.size() > 0){ + CmiManager.getInstance().getGlobalObjectivesManager().setGlobalObjectives(activity, primaryObjective); + } + int i; + for (i = 0; i < activity.sequencing.objectives.objective.size(); i++){ + primaryObjective = activity.sequencing.objectives.objective.get(i); + oe = new ObjectivesElement(); + oe.id.value = primaryObjective.objectiveID; + objectives.add(oe); + if (primaryObjective.mapInfo.size() > 0){ + CmiManager.getInstance().getGlobalObjectivesManager().setGlobalObjectives(activity, primaryObjective); + } + } } - - public void Terminate(String param){ - state = INITIALIZED_TERMINATED; + + public void setValue(String element, String value){ + CmiElement current = getCmiElement(element); + if (current != null){ + current.value = value; + int i; + for (i = 0; i < queryQueue.size(); i++){ + queryQueue.get(i).value = value; + } + queryQueue.clear(); + } } - public boolean setValue(String param, String value){ - values.put(param, value); - - return true; + public String getValue(String element){ + String result = ""; + CmiElement current = getCmiElement(element); + if (current != null){ + result = current.value; + if (!queryQueue.isEmpty()){ + result = queryQueue.get(queryQueue.size() - 1).value; + } + queryQueue.clear(); + } + return result; } - public String getValue(String param){ - return values.get(param); + private CmiElement getCmiElement(String element){ + String first = element; + String second; + int number = 0; + if (element.indexOf(".") != -1){ + first = Utils.getFirst(element); + element = Utils.removeFirst(element); + } + if (element.indexOf(".") != -1){ + number = Integer.parseInt(Utils.getFirst(element)); + element = Utils.removeFirst(element); + } + second = element; + CmiElement returnElement = null; + if (first.equals("_version")){ + returnElement = _version; + } + if (first.equals("comments_from_learner")){ + if (second.equals("_count")){ + returnElement = new CmiElement(""); + returnElement.value = String.valueOf(commentsFromLearner.size()); + } + else{ + CommentsFromLearnerElement cfle; + if (number < commentsFromLearner.size()){ + cfle = commentsFromLearner.get(number); + + } + else{ + cfle = new CommentsFromLearnerElement(); + commentsFromLearner.add(cfle); + } + returnElement = cfle.getCmiElement(second); + } + } + if (first.equals("comments_from_LMS")){ + if (second.equals("_count")){ + returnElement = new CmiElement(""); + returnElement.value = String.valueOf(commentsFromLMS.size()); + } + else{ + CommentsFromLMSElement cfle; + if (number < commentsFromLMS.size()){ + cfle = commentsFromLMS.get(number); + + } + else{ + cfle = new CommentsFromLMSElement(); + commentsFromLMS.add(cfle); + } + returnElement = cfle.getCmiElement(second); + } + } + if (first.equals("completion_status")){ + returnElement = completionStatus; + } + if (first.equals("completion_threshold")){ + returnElement = completionThreshold; + } + if (first.equals("credit")){ + returnElement = credit; + } + if (first.equals("entry")){ + returnElement = entry; + } + if (first.equals("exit")){ + returnElement = exit; + } + if (first.equals("interactions")){ + if (second.equals("_count")){ + returnElement = new CmiElement(""); + returnElement.value = String.valueOf(interactions.size()); + } + else{ + InteractionsElement ie; + if (number < interactions.size()){ + ie = interactions.get(number); + + } + else{ + ie = new InteractionsElement(); + interactions.add(ie); + } + returnElement = ie.getCmiElement(second); + } + } + if (first.equals("launch_data")){ + returnElement = launchData; + } + if (first.equals("learner_id")){ + returnElement = learnerId; + } + if (first.equals("learner_name")){ + returnElement = learnerName; + } + if (first.equals("learner_preference")){ + returnElement = learnerPreference.getCmiElement(second); + } + if (first.equals("location")){ + returnElement = location; + } + if (first.equals("max_time_allowed")){ + returnElement = maxTimeAllowed; + } + if (first.equals("mode")){ + returnElement = mode; + } + if (first.equals("objectives")){ + if (second.equals("_count")){ + returnElement = new CmiElement(""); + returnElement.value = String.valueOf(objectives.size()); + } + else{ + ObjectivesElement oe; + if (number < objectives.size()){ + if (number < 0){ + return null; + } + + oe = objectives.get(number); + CmiManager.getInstance().getGlobalObjectivesManager().getGlobalObjectives(oe, second, queryQueue); + } + else{ + oe = new ObjectivesElement(); + objectives.add(oe); + } + returnElement = oe.getCmiElement(second); + } + } + if (first.equals("progress_measure")){ + returnElement = progressMeasure; + } + if (first.equals("scaled_passing_score")){ + returnElement = scaledPassingScore; + } + if (first.equals("score")){ + returnElement = score.getCmiElement(second); + } + if (first.equals("session_time")){ + returnElement = sessionTime; + } + if (first.equals("success_status")){ + returnElement = successStatus; + } + if (first.equals("suspend_data")){ + returnElement = suspendData; + } + if (first.equals("time_limit_action")){ + returnElement = timeLimitAction; + } + if (first.equals("total_time")){ + returnElement = totalTime; + } + if (first.equals("answers")){ + if (second.equals("_count")){ + returnElement = new CmiElement(""); + returnElement.value = String.valueOf(answers.size()); + } + else{ + AnswersElement ae; + if (number < answers.size()){ + ae = answers.get(number); + + } + else{ + ae = new AnswersElement(); + answers.add(ae); + } + returnElement = ae.getCmiElement(second); + } + } + return returnElement; } - - public int getState() { - return state; - } - - public void setState(int state) { - this.state = state; - } - - public static final int NOT_INITIALIZED_NOT_TERMINATED = 0; - public static final int INITIALIZED_NOT_TERMINATED = 1; - public static final int INITIALIZED_TERMINATED = 2; + +// public void checkResult(){ +// AnswersManager answersManager = new AnswersManager(GlobalStateInformation.getCurrentActivity()); +// answersManager.checkResult(); +// } } Added: RTE/src/edu/lnu/FireFly/Rte/CmiElement.java =================================================================== --- RTE/src/edu/lnu/FireFly/Rte/CmiElement.java (rev 0) +++ RTE/src/edu/lnu/FireFly/Rte/CmiElement.java 2008-05-20 20:25:02 UTC (rev 151) @@ -0,0 +1,19 @@ +package edu.lnu.FireFly.Rte; + +public class CmiElement { + public String value; + public String[] tokens; + + public CmiElement(String v){ + value = v; + } + + public CmiElement(String v, String[] t){ + value = v; + tokens = new String[t.length]; + int i; + for (i = 0; i < t.length; i++){ + tokens[i] = t[i]; + } + } +} Added: RTE/src/edu/lnu/FireFly/Rte/CmiManager.java =================================================================== --- RTE/src/edu/lnu/FireFly/Rte/CmiManager.java (rev 0) +++ RTE/src/edu/lnu/FireFly/Rte/CmiManager.java 2008-05-20 20:25:02 UTC (rev 151) @@ -0,0 +1,50 @@ +package edu.lnu.FireFly.Rte; + +import java.util.HashMap; + +/** + * Manager of Cmi models + * + * @author Yuryj Semen + */ +public class CmiManager { + private static CmiManager obj = null; + private CmiManager(){} + + public static CmiManager getInstance(){ + + if (obj == null){ + obj = new CmiManager(); + } + + return obj; + } + + + /** + * This hashmap containe pairs activity_id <==> CmiModel. + */ + private HashMap<String, Cmi> activitiesVSModels = new HashMap<String, Cmi>(); + + /** + * Global objectives models manager for managing global objectives. + * It is under CMI models. + */ + private GlobalObjectivesManager globalObjectivesManager = new GlobalObjectivesManager(); + public GlobalObjectivesManager getGlobalObjectivesManager() { + return globalObjectivesManager; + } + + /** + * It give a requested Tracking model for specified activity + * @param activity A specified activity for getting Cmi model + * @return Cmi model for specified activity + */ + public Cmi getModelForActivity(Activity activity){ + if (!activitiesVSModels.containsKey(activity.identifier)){ + activitiesVSModels.put(activity.identifier, new Cmi(activity)); + } + + return activitiesVSModels.get(activity.identifier); + } +} Added: RTE/src/edu/lnu/FireFly/Rte/GlobalObjectivesManager.java =================================================================== --- RTE/src/edu/lnu/FireFly/Rte/GlobalObjectivesManager.java (rev 0) +++ RTE/src/edu/lnu/FireFly/Rte/GlobalObjectivesManager.java 2008-05-20 20:25:02 UTC (rev 151) @@ -0,0 +1,50 @@ +package edu.lnu.FireFly.Rte; + +import java.util.ArrayList; + +import edu.lnu.FireFly.FFManifest.item.sequencing.objectives.Objective; +import edu.lnu.FireFly.Rte.elements.ObjectivesElement; + +public class GlobalObjectivesManager { + private ArrayList<ObjectivesElement> globalObjectives = new ArrayList<ObjectivesElement>(); + private ArrayList<ObjectiveMap> objectiveMaps = new ArrayList<ObjectiveMap>(); + + public void setGlobalObjectives(Activity activity, Objective objective){ + int i; + for (i = 0; i < objective.mapInfo.size(); i++){ + if (getObjectiveById(objective.mapInfo.get(i).targetObjectiveID) == null){ + ObjectivesElement oe = new ObjectivesElement(); + oe.id.value = objective.mapInfo.get(i).targetObjectiveID; + globalObjectives.add(oe); + } + ObjectiveMap om = new ObjectiveMap(activity.identifier + objective.objectiveID, objective.mapInfo.get(i).targetObjectiveID); + objectiveMaps.add(om); + } + } + + public void getGlobalObjectives(ObjectivesElement oe, String element, ArrayList<CmiElement> list){ + String id = GlobalStateInformation.getCurrentActivity().identifier + oe.id.value; + int i; + for (i = 0; i < objectiveMaps.size(); i++){ + ObjectiveMap current = objectiveMaps.get(i); + if (current.activityObjectiveID.equals(id)){ + ObjectivesElement global = getObjectiveById(current.targetObjectiveID); + CmiElement ce = global.getCmiElement(element); + list.add(ce); + } + } + + } + + private ObjectivesElement getObjectiveById(String id){ + ObjectivesElement result = null; + int i; + for (i = 0; i < globalObjectives.size(); i++){ + if (globalObjectives.get(i).id.value.equals(id)){ + result = globalObjectives.get(i); + break; + } + } + return result; + } +} Added: RTE/src/edu/lnu/FireFly/Rte/GlobalStateInformation.java =================================================================== --- RTE/src/edu/lnu/FireFly/Rte/GlobalStateInformation.java (rev 0) +++ RTE/src/edu/lnu/FireFly/Rte/GlobalStateInformation.java 2008-05-20 20:25:02 UTC (rev 151) @@ -0,0 +1,20 @@ +package edu.lnu.FireFly.Rte; + +public class GlobalStateInformation { + protected static Activity currentActivity = null; + protected static Activity suspendedActivity = null; + + public static Activity getCurrentActivity(){ + return currentActivity; + } + public static void setCurrentActivity(Activity value){ + currentActivity = value; + } + + public static Activity getSuspendedActivity(){ + return suspendedActivity; + } + public static void setSuspendedActivity(Activity value){ + suspendedActivity = value; + } +} Added: RTE/src/edu/lnu/FireFly/Rte/ObjectiveMap.java =================================================================== --- RTE/src/edu/lnu/FireFly/Rte/ObjectiveMap.java (rev 0) +++ RTE/src/edu/lnu/FireFly/Rte/ObjectiveMap.java 2008-05-20 20:25:02 UTC (rev 151) @@ -0,0 +1,16 @@ +package edu.lnu.FireFly.Rte; + +public class ObjectiveMap { + public String activityObjectiveID = ""; + public String targetObjectiveID = ""; + public boolean readObjectiveSatisfiedStatus = true; + public boolean writeObjectiveSatisfiedStatus = false; + public boolean readObjectiveNormalizedMeasure = true; + public boolean writeObjectiveNormalizedMeasure = false; + + public ObjectiveMap(String localId, String globalId){ + activityObjectiveID = localId; + targetObjectiveID = globalId; + } + +} Added: RTE/src/edu/lnu/FireFly/Rte/Utils.java =================================================================== --- RTE/src/edu/lnu/FireFly/Rte/Utils.java (rev 0) +++ RTE/src/edu/lnu/FireFly/Rte/Utils.java 2008-05-20 20:25:02 UTC (rev 151) @@ -0,0 +1,32 @@ +package edu.lnu.FireFly.Rte; + +public class Utils { + public static String getFirst(String s){ + return s.substring(0, s.indexOf(".")); + } + + public static String removeFirst(String s){ + int index = s.indexOf(".") + 1; + return s.substring(index, s.length()); + } + + public static String getActivityType(Activity activity){ + if (activity == null || activity.getResource() == null){ + return "asset"; + } + + if (activity.getResource().scormType.equals("sco")){ + return "sco"; + } + return "asset"; + } + + public static String getChoiceTarget(String choice){ + choice = choice.substring(choice.indexOf("choice") + 6, choice.length()); + choice = choice.trim(); + choice = choice.substring(choice.indexOf("target") + 6, choice.length() - 1); + choice = choice.trim(); + choice = choice.substring(choice.indexOf("=") + 1, choice.length()); + return choice.trim(); + } +} Added: RTE/src/edu/lnu/FireFly/Rte/elements/AnswersElement.java =================================================================== --- RTE/src/edu/lnu/FireFly/Rte/elements/AnswersElement.java (rev 0) +++ RTE/src/edu/lnu/FireFly/Rte/elements/AnswersElement.java 2008-05-20 20:25:02 UTC (rev 151) @@ -0,0 +1,11 @@ +package edu.lnu.FireFly.Rte.elements; + +import edu.lnu.FireFly.Rte.CmiElement; + +public class AnswersElement implements IElementGetter{ + public CmiElement value = new CmiElement(""); + + public CmiElement getCmiElement(String element){ + return value; + } +} Added: RTE/src/edu/lnu/FireFly/Rte/elements/CommentsFromLMSElement.java =================================================================== --- RTE/src/edu/lnu/FireFly/Rte/elements/CommentsFromLMSElement.java (rev 0) +++ RTE/src/edu/lnu/FireFly/Rte/elements/CommentsFromLMSElement.java 2008-05-20 20:25:02 UTC (rev 151) @@ -0,0 +1,23 @@ +package edu.lnu.FireFly.Rte.elements; + +import edu.lnu.FireFly.Rte.CmiElement; + +public class CommentsFromLMSElement implements IElementGetter { + public CmiElement comment = new CmiElement(""); + public CmiElement location = new CmiElement(""); + public CmiElement timestamp = new CmiElement(""); + + public CmiElement getCmiElement(String element){ + CmiElement returnElement = null; + if (element.equals("comment")){ + returnElement = comment; + } + if (element.equals("location")){ + returnElement = location; + } + if (element.equals("timestamp")){ + returnElement = timestamp; + } + return returnElement; + } +} Added: RTE/src/edu/lnu/FireFly/Rte/elements/CommentsFromLearnerElement.java =================================================================== --- RTE/src/edu/lnu/FireFly/Rte/elements/CommentsFromLearnerElement.java (rev 0) +++ RTE/src/edu/lnu/FireFly/Rte/elements/CommentsFromLearnerElement.java 2008-05-20 20:25:02 UTC (rev 151) @@ -0,0 +1,23 @@ +package edu.lnu.FireFly.Rte.elements; + +import edu.lnu.FireFly.Rte.CmiElement; + +public class CommentsFromLearnerElement implements IElementGetter{ + public CmiElement comment = new CmiElement(""); + public CmiElement location = new CmiElement(""); + public CmiElement timestamp = new CmiElement(""); + + public CmiElement getCmiElement(String element){ + CmiElement returnElement = null; + if (element.equals("comment")){ + returnElement = comment; + } + if (element.equals("location")){ + returnElement = location; + } + if (element.equals("timestamp")){ + returnElement = timestamp; + } + return returnElement; + } +} Added: RTE/src/edu/lnu/FireFly/Rte/elements/IElementGetter.java =================================================================== --- RTE/src/edu/lnu/FireFly/Rte/elements/IElementGetter.java (rev 0) +++ RTE/src/edu/lnu/FireFly/Rte/elements/IElementGetter.java 2008-05-20 20:25:02 UTC (rev 151) @@ -0,0 +1,7 @@ +package edu.lnu.FireFly.Rte.elements; + +import edu.lnu.FireFly.Rte.CmiElement; + +public interface IElementGetter { + public CmiElement getCmiElement(String element); +} Added: RTE/src/edu/lnu/FireFly/Rte/elements/InteractionsCorrectResponsesElement.java =================================================================== --- RTE/src/edu/lnu/FireFly/Rte/elements/InteractionsCorrectResponsesElement.java (rev 0) +++ RTE/src/edu/lnu/FireFly/Rte/elements/InteractionsCorrectResponsesElement.java 2008-05-20 20:25:02 UTC (rev 151) @@ -0,0 +1,11 @@ +package edu.lnu.FireFly.Rte.elements; + +import edu.lnu.FireFly.Rte.CmiElement; + +public class InteractionsCorrectResponsesElement implements IElementGetter { + public CmiElement pattern = new CmiElement(""); + + public CmiElement getCmiElement(String element){ + return pattern; + } +} Added: RTE/src/edu/lnu/FireFly/Rte/elements/InteractionsElement.java =================================================================== --- RTE/src/edu/lnu/FireFly/Rte/elements/InteractionsElement.java (rev 0) +++ RTE/src/edu/lnu/FireFly/Rte/elements/InteractionsElement.java 2008-05-20 20:25:02 UTC (rev 151) @@ -0,0 +1,96 @@ +package edu.lnu.FireFly.Rte.elements; + +import java.util.ArrayList; + +import edu.lnu.FireFly.Rte.CmiElement; +import edu.lnu.FireFly.Rte.Utils; + +public class InteractionsElement implements IElementGetter { + public CmiElement id = new CmiElement(""); + public CmiElement type = new CmiElement(""); + public ArrayList<InteractionsObjectivesElement> objectives = new ArrayList<InteractionsObjectivesElement>(); + public CmiElement timestamp = new CmiElement(""); + public ArrayList<InteractionsCorrectResponsesElement> correctResponses = new ArrayList<InteractionsCorrectResponsesElement>(); + public CmiElement weighting = new CmiElement(""); + public CmiElement learnerResponse = new CmiElement(""); + public CmiElement result = new CmiElement("", new String[]{"correct", "incorrect", "unanticipated", "neutral", "real (10,7)"}); + public CmiElement latency = new CmiElement(""); + public CmiElement description = new CmiElement(""); + + public CmiElement getCmiElement(String element){ + CmiElement returnElement = null; + if (element.equals("id")){ + returnElement = id; + } + if (element.equals("type")){ + returnElement = type; + } + if (element.startsWith("objectives")){ + element = Utils.removeFirst(element); + int number = 0; + if (element.indexOf(".") != -1){ + number = Integer.parseInt(Utils.getFirst(element)); + element = Utils.removeFirst(element); + } + if (element.equals("_count")){ + returnElement = new CmiElement(""); + returnElement.value = String.valueOf(objectives.size()); + } + else{ + InteractionsObjectivesElement ioe; + if (number < objectives.size()){ + ioe = objectives.get(number); + + } + else{ + ioe = new InteractionsObjectivesElement(); + objectives.add(ioe); + } + returnElement = ioe.getCmiElement(element); + } + } + if (element.equals("timestamp")){ + returnElement = timestamp; + } + if (element.equals("correct_responses")){ + element = Utils.removeFirst(element); + int number = 0; + if (element.indexOf(".") != -1){ + number = Integer.parseInt(Utils.getFirst(element)); + element = Utils.removeFirst(element); + } + if (element.equals("_count")){ + returnElement = new CmiElement(""); + returnElement.value = String.valueOf(correctResponses.size()); + } + else{ + InteractionsCorrectResponsesElement icre; + if (number < correctResponses.size()){ + icre = correctResponses.get(number); + + } + else{ + icre = new InteractionsCorrectResponsesElement(); + correctResponses.add(icre); + } + returnElement = icre.getCmiElement(element); + } + } + if (element.equals("weighting")){ + returnElement = weighting; + } + if (element.equals("learner_response")){ + returnElement = learnerResponse; + } + if (element.equals("result")){ + returnElement = result; + } + if (element.equals("latency")){ + returnElement = latency; + } + if (element.equals("description")){ + returnElement = description; + } + return returnElement; + } +} Added: RTE/src/edu/lnu/FireFly/Rte/elements/InteractionsObjectivesElement.java =================================================================== --- RTE/src/edu/lnu/FireFly/Rte/elements/InteractionsObjectivesElement.java (rev 0) +++ RTE/src/edu/lnu/FireFly/Rte/elements/InteractionsObjectivesElement.java 2008-05-20 20:25:02 UTC (rev 151) @@ -0,0 +1,11 @@ +package edu.lnu.FireFly.Rte.elements; + +import edu.lnu.FireFly.Rte.CmiElement; + +public class InteractionsObjectivesElement implements IElementGetter { + public CmiElement id = new CmiElement(""); + + public CmiElement getCmiElement(String element){ + return id; + } +} Added: RTE/src/edu/lnu/FireFly/Rte/elements/LearnerPreferenceElement.java =================================================================== --- RTE/src/edu/lnu/FireFly/Rte/elements/LearnerPreferenceElement.java (rev 0) +++ RTE/src/edu/lnu/FireFly/Rte/elements/LearnerPreferenceElement.java 2008-05-20 20:25:02 UTC (rev 151) @@ -0,0 +1,27 @@ +package edu.lnu.FireFly.Rte.elements; + +import edu.lnu.FireFly.Rte.CmiElement; + +public class LearnerPreferenceElement implements IElementGetter { + public CmiElement audioLevel = new CmiElement("0"); + public CmiElement language = new CmiElement(""); + public CmiElement deliverySpeed = new CmiElement("0"); + public CmiElement audioCaptioning = new CmiElement(""); + + public CmiElement getCmiElement(String element) { + CmiElement returnElement = null; + if (element.equals("audio_level")){ + returnElement = audioLevel; + } + if (element.equals("language")){ + returnElement = language; + } + if (element.equals("delivery_speed")){ + returnElement = deliverySpeed; + } + if (element.equals("audio_captioning")){ + returnElement = audioCaptioning; + } + return returnElement; + } +} Added: RTE/src/edu/lnu/FireFly/Rte/elements/ObjectivesElement.java =================================================================== --- RTE/src/edu/lnu/FireFly/Rte/elements/ObjectivesElement.java (rev 0) +++ RTE/src/edu/lnu/FireFly/Rte/elements/ObjectivesElement.java 2008-05-20 20:25:02 UTC (rev 151) @@ -0,0 +1,34 @@ +package edu.lnu.FireFly.Rte.elements; + +import edu.lnu.FireFly.Rte.CmiElement; +import edu.lnu.FireFly.Rte.Utils; + +public class ObjectivesElement implements IElementGetter { + + public CmiElement id = new CmiElement(""); + public ScoreElement score = new ScoreElement(); + public CmiElement completionStatus = new CmiElement("unknown", new String[]{"completed", "incomplete", "not attempted", "unknown"}); + public CmiElement progressMeasure = new CmiElement(""); + public CmiElement description = new CmiElement(""); + + public CmiElement getCmiElement(String element){ + CmiElement returnElement = null; + if (element.equals("id")){ + returnElement = id; + } + if (element.startsWith("score")){ + element = Utils.removeFirst(element); + returnElement = score.getCmiElement(element); + } + if (element.equals("completion_status")){ + returnElement = completionStatus; + } + if (element.equals("progress_measure")){ + returnElement = progressMeasure; + } + if (element.equals("description")){ + returnElement = description; + } + return returnElement; + } +} Added: RTE/src/edu/lnu/FireFly/Rte/elements/ScoreElement.java =================================================================== --- RTE/src/edu/lnu/FireFly/Rte/elements/ScoreElement.java (rev 0) +++ RTE/src/edu/lnu/FireFly/Rte/elements/ScoreElement.java 2008-05-20 20:25:02 UTC (rev 151) @@ -0,0 +1,27 @@ +package edu.lnu.FireFly.Rte.elements; + +import edu.lnu.FireFly.Rte.CmiElement; + +public class ScoreElement implements IElementGetter { + public CmiElement scaled = new CmiElement(""); + public CmiElement raw = new CmiElement(""); + public CmiElement max = new CmiElement(""); + public CmiElement min = new CmiElement(""); + + public CmiElement getCmiElement(String element){ + CmiElement returnElement = null; + if (element.equals("scaled")){ + returnElement = scaled; + } + if (element.equals("raw")){ + returnElement = raw; + } + if (element.equals("max")){ + returnElement = max; + } + if (element.equals("min")){ + returnElement = min; + } + return returnElement; + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |