java: isac.util.tactics .. end renamed, formatted, inst_var_, import cleaned
2 * Created on Feb 22, 2005
4 * To change the template for this generated file go to
5 * Window>Preferences>Java>Code Generation>Code and Comments
7 package isac.util.users;
9 import java.io.FileOutputStream;
10 import java.io.IOException;
11 import java.util.Properties;
14 * @author Alan Krempler
16 * The UserModel is a class to gather statistics about one user's interaction
17 * with the system. Statistis are gathered per user and per interactional
20 public class UserModel extends Properties {
22 // special value for retrieving the statistics regardless of the dialog atom
23 // used in the interaction
24 public static final int DIALOG_ATOM_ANY = 0;
26 // counter for identifying pending interactions
27 private static int interaction_nr_ = 1;
29 private String userpath_;
31 private String username_;
33 public UserModel(String userpath, String username) {
41 * ID of the item being queried, a tactic for example
43 * ID of the interactional context use DIALOG_ATOM_ANY if asking
44 * for statistics for all dialog atoms
45 * @return count of previously recorded interactions with this item
47 public int getTouchedCount(int item_id, int dialog_atom) {
48 // FIXME: returning dummy value in absence of valid statistics
54 * ID of the item being queried, a tactic for example
56 * ID of the interactional context use DIALOG_ATOM_ANY if asking
57 * for statistics for all dialog atoms
58 * @return count of previously recorded successful interactions with this
61 public int getSuccessCount(int item_id, int dialog_atom) {
62 // FIXME: returning dummy value in absence of valid statistics
68 * ID of the item being queried, a tactic for example
70 * ID of the interactional context use DIALOG_ATOM_ANY if asking
71 * for statistics for all dialog atoms
72 * @return time of last recorded interaction with this item
74 public java.util.Date getTouchedLast(int item_id, int dialog_atom) {
75 // FIXME: returning dummy value in absence of valid statistics
76 return new java.util.Date();
81 * ID of the item being queried, a tactic for example
83 * ID of the interactional context use DIALOG_ATOM_ANY if asking
84 * for statistics for all dialog atoms
85 * @return time of last recorded successful interaction with this item
87 public java.util.Date getSuccessLast(int item_id, int dialog_atom) {
88 // FIXME: returning dummy value in absence of valid statistics
89 return new java.util.Date();
94 * ID of the item being queried, a tactic for example
96 * ID of the interactional context use DIALOG_ATOM_ANY if asking
97 * for statistics for all dialog atoms
98 * @return average time (seconds) spent in interactions with this item
100 public int getTimeSpentAvg(int item_id, int dialog_atom) {
101 // FIXME: returning dummy value in absence of valid statistics
107 * ID of the item being queried, a tactic for example
109 * ID of the interactional context use DIALOG_ATOM_ANY if asking
110 * for statistics for all dialog atoms
111 * @return maximum time (seconds) spent in interactions with this item
113 public int getTimeSpentMax(int item_id, int dialog_atom) {
114 // FIXME: returning dummy value in absence of valid statistics
120 * ID of the item being queried, a tactic for example
122 * ID of the interactional context use DIALOG_ATOM_ANY if asking
123 * for statistics for all dialog atoms
124 * @return standard deviation of time spent in interactions with this item
126 public float getTimeSpentStddev(int item_id, int dialog_atom) {
127 // FIXME: returning dummy value in absence of valid statistics
132 * Mark the beginning of an interaction with an item.
135 * ID of the item being acted upon, a tactic for example
137 * ID of the interactional context
138 * @return unique number to indentify the end of the transaction
140 public int startInteraction(int item_id, int dialog_atom) {
141 // FIXME: insert code to record statistics
144 // new java.util.Date(); ...
146 // save in static vector of currently open interactions
149 return interaction_nr_++;
153 * Mark the end of an interaction with an item.
155 * @param interaction_id
156 * ID of the interaction returned from the call to
157 * {@link # startInteraction() }
159 * information about the success of the interaction
160 * @return false in case of failure - no matching start could be found, true
163 public boolean endInteraction(int interaction_id, int success) {
164 // FIXME: insert code to record statistics
166 // record end timestamp
167 // new java.util.Date(); ...
171 // delete from static vector of currently open interactions
177 //WN050311 just for creation of the first file
178 //beware of the fix path !
179 public static void main(String[] args) {
180 UserModel a = new UserModel("isac/xmldata/users", "x");
181 a.setProperty("TODO-key", "TODO-value");
183 String filename = "isac/xmldata/users/x_model.txt";
185 FileOutputStream propOutFile = new FileOutputStream(filename);
186 a.store(propOutFile, "dynamic dialog data of user 'x'");
188 } catch (IOException e) {
189 System.err.println("I/O failed.");