source: trunk/src/org/expeditee/stats/TreeStats.java@ 1415

Last change on this file since 1415 was 1415, checked in by bln4, 5 years ago

Renamed Frame.getItems() to Frame.getSortedItems() to better represent its functionality.

-> org.apollo.ApolloGestureActions
-> org.apollo.ApolloSystem
-> org.expeditee.actions.Actions
-> org.expeditee.actions.Debug
-> org.expeditee.actions.ExploratorySearchActions
-> org.expeditee.actions.JfxBrowserActions
-> org.expeditee.actions.Misc
-> org.expeditee.actions.Navigation
-> org.expeditee.actions.ScriptBase
-> org.expeditee.actions.Simple
-> org.expeditee.agents.ComputeTree
-> org.expeditee.agents.CopyTree
-> org.expeditee.agents.DisplayComet
-> org.expeditee.agents.DisplayTree
-> org.expeditee.agents.DisplayTreeLeaves
-> org.expeditee.agents.GraphFramesetLinks
-> org.expeditee.agents.TreeProcessor
-> org.expeditee.gio.gesture.StandardGestureActions
-> org.expeditee.gui.DisplayController
-> org.expeditee.gui.FrameCreator
-> org.expeditee.gui.FrameIO
-> org.expeditee.io.DefaultTreeWriter
-> org.expeditee.io.JavaWriter
-> org.expeditee.io.PDF2Writer
-> org.expeditee.io.TXTWriter
-> org.expeditee.io.WebParser
-> org.expeditee.io.flowlayout.XGroupItem
-> org.expeditee.items.Dot
-> org.expeditee.items.Item
-> org.expeditee.items.ItemUtils
-> org.expeditee.network.FrameShare
-> org.expeditee.stats.TreeStats


Created ItemsList class to wrap ArrayList<Item>. Frames now use this new class to store its body list (used for display) as well as its primaryBody and surrogateBody.

-> org.expeditee.agents.Format
-> org.expeditee.agents.HFormat
-> org.expeditee.gio.gesture.StandardGestureActions
-> org.expeditee.gui.Frame
-> org.expeditee.gui.FrameUtils


Refactorted Frame.setResort(bool) to Frame.invalidateSorted() to better function how it is intended to with a more accurate name.

-> org.expeditee.agents.Sort


When writing out .exp files and getting attributes to respond to LEFT + RIGHT click, boolean items are by default true. This has always been the case. An ammendment to this is that defaults can now be established.
Also added 'EnterClick' functionality. If cursored over a item with this property and you press enter, it acts as if you have clicked on it instead.

-> org.expeditee.assets.resources-public.framesets.authentication.1.exp to 6.exp
-> org.expeditee.gio.gesture.StandardGestureActions
-> org.expeditee.gio.input.KBMInputEvent
-> org.expeditee.gio.javafx.JavaFXConversions
-> org.expeditee.gio.swing.SwingConversions
-> org.expeditee.gui.AttributeUtils
-> org.expeditee.io.Conversion
-> org.expeditee.io.DefaultFrameWriter
-> org.expeditee.items.Item


Fixed a bug caused by calling Math.abs on Integer.MIN_VALUE returning unexpected result. Due to zero being a thing, you cannot represent Math.abs(Integer.MIN_VALUE) in a Integer object. The solution is to use Integer.MIN_VALUE + 1 instead of Integer.MIN_VALUE.

-> org.expeditee.core.bounds.CombinationBounds
-> org.expeditee.io.flowlayout.DimensionExtent


Recoded the contains function in EllipticalBounds so that intersection tests containing circles work correctly.

-> org.expeditee.core.bounds.EllipticalBounds


Added toString() to PolygonBounds to allow for useful printing during debugging.

-> org.expeditee.core.bounds.PolygonBounds

Implemented Surrogate Mode!

-> org.expeditee.encryption.io.EncryptedExpReader
-> org.expeditee.encryption.io.EncryptedExpWriter
-> org.expeditee.encryption.items.surrogates.EncryptionDetail
-> org.expeditee.encryption.items.surrogates.Label
-> org.expeditee.gui.FrameUtils
-> org.expeditee.gui.ItemsList
-> org.expeditee.items.Item
-> org.expeditee.items.Text


???? Use Integer.MAX_VALUE cast to a float instead of Float.MAX_VALUE. This fixed some bug which I cannot remember.

-> org.expeditee.gio.TextLayoutManager
-> org.expeditee.gio.swing.SwingTextLayoutManager


Improved solution for dealing with the F10 key taking focus away from Expeditee due to it being a assessibility key.

-> org.expeditee.gio.swing.SwingInputManager


Renamed variable visibleItems in FrameGraphics.paintFrame to itemsToPaintCanditates to better represent functional intent.

-> org.expeditee.gui.FrameGraphics


Improved checking for if personal resources exist before recreating them

-> org.expeditee.gui.FrameIO


Repeated messages to message bay now have a visual feedback instead of just a beep. This visual feedback is in the form of a count of the amount of times it has repeated.

-> org.expeditee.gui.MessageBay


Updated comment on the Vector class to explain what vectors are.

-> org.expeditee.gui.Vector


Added constants to represent all of the property keys in DefaultFrameReader and DefaultFrameWriter.

-> org.expeditee.io.DefaultFrameReader
-> org.expeditee.io.DefaultFrameWriter


Updated the KeyList setting to be more heirarcial with how users will store their Secrets.

-> org.expeditee.settings.identity.secrets.KeyList

File size: 4.7 KB
Line 
1/**
2 * TreeStats.java
3 * Copyright (C) 2010 New Zealand Digital Library, http://expeditee.org
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19package org.expeditee.stats;
20
21import java.sql.Time;
22import java.util.HashSet;
23import java.util.Set;
24
25import org.expeditee.gui.Frame;
26import org.expeditee.gui.FrameIO;
27import org.expeditee.gui.MessageBay;
28import org.expeditee.items.Item;
29
30public class TreeStats extends CometStats {
31 protected int _treeFrames = 0;
32
33 protected int _treeSessions = 0;
34
35 protected long _treeActive = 0;
36
37 protected long _treeDark = 0;
38
39 public TreeStats(Frame topFrame) {
40 this(topFrame, new HashSet<String>());
41 }
42
43 public TreeStats(Frame topFrame, Set<String> visited) {
44 super(topFrame);
45 //TreeStats doesnt include the current session.
46 _active = topFrame.getActiveTime().getTime();
47 _dark = topFrame.getDarkTime().getTime();
48 _sessions -= 1;
49
50 visited.add(_name.toLowerCase());
51 MessageBay.overwriteMessage("Computed: " + _name);
52
53 // Initialise variables with the data for this frames comet
54 _treeActive = _active;
55 _treeDark = _dark;
56 _treeSessions = _sessions;
57 _treeFrames = 1;
58 // Now get all add all the trees for linked items
59 for (Item i : topFrame.getSortedItems()) {
60 String link = i.getAbsoluteLink();
61 if (link == null)
62 continue;
63 if (i.isAnnotation())
64 continue;
65 // Stop infinate loops by not visiting nodes we have already visited
66 if (visited.contains(link.toLowerCase())) {
67 continue;
68 }
69 Frame childFrame = FrameIO.LoadFrame(i.getAbsoluteLink());
70 if (childFrame == null)
71 continue;
72
73 TreeStats childItemStats = new TreeStats(childFrame, visited);
74 _treeActive += childItemStats._treeActive;
75 _treeDark += childItemStats._treeDark;
76 _treeSessions += childItemStats._treeSessions;
77 _treeFrames += childItemStats._treeFrames;
78 }
79 }
80
81 @Override
82 public String toString() {
83 Time total = new Time(_treeActive + _treeDark);
84 Time active = new Time(_treeActive);
85 Time dark = new Time(_treeDark);
86
87 StringBuffer sb = new StringBuffer();
88 sb.append(SessionStats.getDate());
89 sb.append("TreeStats: ").append(_name).append('\n');
90 sb.append("Frames: ").append(_treeFrames).append('\n');
91 sb.append("Versions: ").append(_treeSessions).append('\n');
92 sb.append(String.format(
93 " %cVersionAve%c FrameAve %c Total%n",
94 COLUMN_SEPARATOR_CHAR, COLUMN_SEPARATOR_CHAR,
95 COLUMN_SEPARATOR_CHAR));
96
97 StringBuffer rowSeparator = new StringBuffer();
98 rowSeparator.append(getBufferedString(10, ROW_SEPARATOR_CHAR));
99 for (int i = 0; i < 3; i++) {
100 rowSeparator.append(ROW_COLUMN_SEPARATOR).append(
101 getBufferedString(8, ROW_SEPARATOR_CHAR));
102 }
103 sb.append(rowSeparator).append('\n');
104
105 Time averageActive = new Time((long) (0.5 + active.getTime()
106 / (1.0 * _treeFrames)));
107 Time averageDark = new Time((long) (0.5 + dark.getTime()
108 / (1.0 * _treeFrames)));
109 Time averageTotal = new Time((long) (0.5 + total.getTime()
110 / (1.0 * _treeFrames)));
111 Time averageActiveEdit = new Time((long) (0.5 + active.getTime()
112 / (1.0 * _treeSessions)));
113 Time averageDarkEdit = new Time((long) (0.5 + dark.getTime()
114 / (1.0 * _treeSessions)));
115 Time averageTotalEdit = new Time((long) (0.5 + total.getTime()
116 / (1.0 * _treeSessions)));
117
118 sb.append("ActiveTime").append(COLUMN_SEPARATOR).append(
119 Formatter.getTimePeriod(averageActiveEdit)).append(
120 COLUMN_SEPARATOR).append(Formatter.getTimePeriod(averageActive))
121 .append(COLUMN_SEPARATOR).append(Formatter.getTimePeriod(active))
122 .append('\n');
123 sb.append(" DarkTime").append(COLUMN_SEPARATOR).append(
124 Formatter.getTimePeriod(averageDarkEdit))
125 .append(COLUMN_SEPARATOR).append(
126 Formatter.getTimePeriod(averageDark)).append(
127 COLUMN_SEPARATOR).append(Formatter.getTimePeriod(dark))
128 .append('\n');
129 sb.append(" TotalTime").append(COLUMN_SEPARATOR).append(
130 Formatter.getTimePeriod(averageTotalEdit)).append(
131 COLUMN_SEPARATOR).append(Formatter.getTimePeriod(averageTotal))
132 .append(COLUMN_SEPARATOR).append(Formatter.getTimePeriod(total))
133 .append('\n');
134 sb.append(rowSeparator.toString().replace(ROW_COLUMN_SEPARATOR_CHAR,
135 BOTTOM_COLUMN_SEPARATOR_CHAR));
136
137 return sb.toString();
138 }
139}
Note: See TracBrowser for help on using the repository browser.