1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/src/java/isac/util/usersettings/UserModel.java Wed Jun 15 18:31:02 2005 +0200
1.3 @@ -0,0 +1,163 @@
1.4 +/*
1.5 + * Created on Feb 22, 2005
1.6 + *
1.7 + * To change the template for this generated file go to
1.8 + * Window>Preferences>Java>Code Generation>Code and Comments
1.9 + */
1.10 +package isac.util.usersettings;
1.11 +
1.12 +/**
1.13 + * @author Alan Krempler
1.14 + *
1.15 + * The UserModel is a class to gather statistics about one user's interaction
1.16 + * with the system. Statistis are gathered per user and per interactional
1.17 + * context.
1.18 + */
1.19 +public class UserModel {
1.20 +
1.21 + // special value for retrieving the statistics regardless of the dialog atom
1.22 + // used in the interaction
1.23 + public static final int DIALOG_ATOM_ANY = 0;
1.24 +
1.25 + // counter for identifying pending interactions
1.26 + private static int interaction_nr_ = 1;
1.27 +
1.28 + /**
1.29 + * @param item_id
1.30 + * ID of the item being queried, a tactic for example
1.31 + * @param dialog_atom
1.32 + * ID of the interactional context use DIALOG_ATOM_ANY if asking
1.33 + * for statistics for all dialog atoms
1.34 + * @return count of previously recorded interactions with this item
1.35 + */
1.36 + public int getTouchedCount(int item_id, int dialog_atom) {
1.37 + // FIXME: returning dummy value in absence of valid statistics
1.38 + return 0;
1.39 + }
1.40 +
1.41 + /**
1.42 + * @param item_id
1.43 + * ID of the item being queried, a tactic for example
1.44 + * @param dialog_atom
1.45 + * ID of the interactional context use DIALOG_ATOM_ANY if asking
1.46 + * for statistics for all dialog atoms
1.47 + * @return count of previously recorded successful interactions with this
1.48 + * item
1.49 + */
1.50 + public int getSuccessCount(int item_id, int dialog_atom) {
1.51 + // FIXME: returning dummy value in absence of valid statistics
1.52 + return 0;
1.53 + }
1.54 +
1.55 + /**
1.56 + * @param item_id
1.57 + * ID of the item being queried, a tactic for example
1.58 + * @param dialog_atom
1.59 + * ID of the interactional context use DIALOG_ATOM_ANY if asking
1.60 + * for statistics for all dialog atoms
1.61 + * @return time of last recorded interaction with this item
1.62 + */
1.63 + public java.util.Date getTouchedLast(int item_id, int dialog_atom) {
1.64 + // FIXME: returning dummy value in absence of valid statistics
1.65 + return new java.util.Date();
1.66 + }
1.67 +
1.68 + /**
1.69 + * @param item_id
1.70 + * ID of the item being queried, a tactic for example
1.71 + * @param dialog_atom
1.72 + * ID of the interactional context use DIALOG_ATOM_ANY if asking
1.73 + * for statistics for all dialog atoms
1.74 + * @return time of last recorded successful interaction with this item
1.75 + */
1.76 + public java.util.Date getSuccessLast(int item_id, int dialog_atom) {
1.77 + // FIXME: returning dummy value in absence of valid statistics
1.78 + return new java.util.Date();
1.79 + }
1.80 +
1.81 + /**
1.82 + * @param item_id
1.83 + * ID of the item being queried, a tactic for example
1.84 + * @param dialog_atom
1.85 + * ID of the interactional context use DIALOG_ATOM_ANY if asking
1.86 + * for statistics for all dialog atoms
1.87 + * @return average time (seconds) spent in interactions with this item
1.88 + */
1.89 + public int getTimeSpentAvg(int item_id, int dialog_atom) {
1.90 + // FIXME: returning dummy value in absence of valid statistics
1.91 + return 0;
1.92 + }
1.93 +
1.94 + /**
1.95 + * @param item_id
1.96 + * ID of the item being queried, a tactic for example
1.97 + * @param dialog_atom
1.98 + * ID of the interactional context use DIALOG_ATOM_ANY if asking
1.99 + * for statistics for all dialog atoms
1.100 + * @return maximum time (seconds) spent in interactions with this item
1.101 + */
1.102 + public int getTimeSpentMax(int item_id, int dialog_atom) {
1.103 + // FIXME: returning dummy value in absence of valid statistics
1.104 + return 0;
1.105 + }
1.106 +
1.107 + /**
1.108 + * @param item_id
1.109 + * ID of the item being queried, a tactic for example
1.110 + * @param dialog_atom
1.111 + * ID of the interactional context use DIALOG_ATOM_ANY if asking
1.112 + * for statistics for all dialog atoms
1.113 + * @return standard deviation of time spent in interactions with this item
1.114 + */
1.115 + public float getTimeSpentStddev(int item_id, int dialog_atom) {
1.116 + // FIXME: returning dummy value in absence of valid statistics
1.117 + return 0;
1.118 + }
1.119 +
1.120 + /**
1.121 + * Mark the beginning of an interaction with an item.
1.122 + *
1.123 + * @param item_id
1.124 + * ID of the item being acted upon, a tactic for example
1.125 + * @param dialog_atom
1.126 + * ID of the interactional context
1.127 + * @return unique number to indentify the end of the transaction
1.128 + */
1.129 + public int startInteraction(int item_id, int dialog_atom) {
1.130 + // FIXME: insert code to record statistics
1.131 +
1.132 + // record timestamp
1.133 + // new java.util.Date(); ...
1.134 +
1.135 + // save in static vector of currently open interactions
1.136 + // ...
1.137 +
1.138 + return interaction_nr_++;
1.139 + }
1.140 +
1.141 + /**
1.142 + * Mark the end of an interaction with an item.
1.143 + *
1.144 + * @param interaction_id
1.145 + * ID of the interaction returned from the call to
1.146 + * {@link # startInteraction() }
1.147 + * @param success
1.148 + * information about the success of the interaction
1.149 + * @return false in case of failure - no matching start could be found, true
1.150 + * in case of success
1.151 + */
1.152 + public boolean endInteraction(int interaction_id, int success) {
1.153 + // FIXME: insert code to record statistics
1.154 +
1.155 + // record end timestamp
1.156 + // new java.util.Date(); ...
1.157 +
1.158 + // add to statistics
1.159 +
1.160 + // delete from static vector of currently open interactions
1.161 + // ...
1.162 +
1.163 + return true;
1.164 + }
1.165 +
1.166 +}
1.167 \ No newline at end of file