[919] | 1 | /**
|
---|
| 2 | * StatsFrame.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 |
|
---|
[427] | 19 | package org.expeditee.stats;
|
---|
| 20 |
|
---|
| 21 | import java.lang.reflect.Method;
|
---|
| 22 | import java.util.HashMap;
|
---|
| 23 | import java.util.Map;
|
---|
| 24 |
|
---|
[1102] | 25 | import org.expeditee.gio.input.KBMInputEvent;
|
---|
| 26 |
|
---|
[427] | 27 | public class StatsFrame extends SessionStats {
|
---|
| 28 |
|
---|
| 29 | private static Map<String, Method> _getMethods = null;
|
---|
| 30 |
|
---|
| 31 | public static Method getMethod(String name) {
|
---|
| 32 | if(_getMethods == null){
|
---|
| 33 | init();
|
---|
| 34 | }
|
---|
| 35 |
|
---|
| 36 | return _getMethods.get(name.trim().toLowerCase());
|
---|
| 37 | }
|
---|
| 38 |
|
---|
| 39 | private static void init() {
|
---|
| 40 | _getMethods = new HashMap<String, Method>();
|
---|
| 41 | for (Method m : StatsFrame.class.getMethods()) {
|
---|
| 42 | if (m.getReturnType().equals(String.class)) {
|
---|
| 43 | _getMethods.put(m.getName().substring(3).toLowerCase(), m);
|
---|
| 44 | }
|
---|
| 45 | }
|
---|
| 46 | }
|
---|
| 47 |
|
---|
| 48 | public static String getTextCreated() {
|
---|
| 49 | return _ItemStats[ItemType.Text.ordinal()][StatType.Created.ordinal()]
|
---|
| 50 | + "";
|
---|
| 51 | }
|
---|
| 52 |
|
---|
| 53 | public static String getTextMoved() {
|
---|
| 54 | return _ItemStats[ItemType.Text.ordinal()][StatType.Moved.ordinal()]
|
---|
| 55 | + "";
|
---|
| 56 | }
|
---|
| 57 |
|
---|
| 58 | public static String getTextDeleted() {
|
---|
| 59 | return _ItemStats[ItemType.Text.ordinal()][StatType.Deleted.ordinal()]
|
---|
| 60 | + "";
|
---|
| 61 | }
|
---|
| 62 |
|
---|
| 63 | public static String getTextCopied() {
|
---|
| 64 | return _ItemStats[ItemType.Text.ordinal()][StatType.Copied.ordinal()]
|
---|
| 65 | + "";
|
---|
| 66 | }
|
---|
| 67 |
|
---|
| 68 | public static String getItemsCreated() {
|
---|
| 69 | return _ItemStats[ItemType.Total.ordinal()][StatType.Created.ordinal()]
|
---|
| 70 | + "";
|
---|
| 71 | }
|
---|
| 72 |
|
---|
| 73 | public static String getItemsMoved() {
|
---|
| 74 | return _ItemStats[ItemType.Total.ordinal()][StatType.Moved.ordinal()]
|
---|
| 75 | + "";
|
---|
| 76 | }
|
---|
| 77 |
|
---|
| 78 | public static String getItemsDeleted() {
|
---|
| 79 | return _ItemStats[ItemType.Total.ordinal()][StatType.Deleted.ordinal()]
|
---|
| 80 | + "";
|
---|
| 81 | }
|
---|
| 82 |
|
---|
| 83 | public static String getItemsCopied() {
|
---|
| 84 | return _ItemStats[ItemType.Total.ordinal()][StatType.Copied.ordinal()]
|
---|
| 85 | + "";
|
---|
| 86 | }
|
---|
| 87 |
|
---|
| 88 | public static String getPicturesCreated() {
|
---|
| 89 | return _ItemStats[ItemType.Picture.ordinal()][StatType.Created.ordinal()]
|
---|
| 90 | + "";
|
---|
| 91 | }
|
---|
| 92 |
|
---|
| 93 | public static String getPicturesMoved() {
|
---|
| 94 | return _ItemStats[ItemType.Picture.ordinal()][StatType.Moved.ordinal()]
|
---|
| 95 | + "";
|
---|
| 96 | }
|
---|
| 97 |
|
---|
| 98 | public static String getPicturesDeleted() {
|
---|
| 99 | return _ItemStats[ItemType.Picture.ordinal()][StatType.Deleted.ordinal()]
|
---|
| 100 | + "";
|
---|
| 101 | }
|
---|
| 102 |
|
---|
| 103 | public static String getPicturesCopied() {
|
---|
| 104 | return _ItemStats[ItemType.Picture.ordinal()][StatType.Copied.ordinal()]
|
---|
| 105 | + "";
|
---|
| 106 | }
|
---|
| 107 |
|
---|
| 108 | public static String getDotsCreated() {
|
---|
| 109 | return _ItemStats[ItemType.Dot.ordinal()][StatType.Created.ordinal()]
|
---|
| 110 | + "";
|
---|
| 111 | }
|
---|
| 112 |
|
---|
| 113 | public static String getDotsMoved() {
|
---|
| 114 | return _ItemStats[ItemType.Dot.ordinal()][StatType.Moved.ordinal()]
|
---|
| 115 | + "";
|
---|
| 116 | }
|
---|
| 117 |
|
---|
| 118 | public static String getDotsDeleted() {
|
---|
| 119 | return _ItemStats[ItemType.Dot.ordinal()][StatType.Deleted.ordinal()]
|
---|
| 120 | + "";
|
---|
| 121 | }
|
---|
| 122 |
|
---|
| 123 | public static String getDotsCopied() {
|
---|
| 124 | return _ItemStats[ItemType.Dot.ordinal()][StatType.Copied.ordinal()]
|
---|
| 125 | + "";
|
---|
| 126 | }
|
---|
| 127 |
|
---|
| 128 | public static String getLinesCreated() {
|
---|
| 129 | return _ItemStats[ItemType.Line.ordinal()][StatType.Created.ordinal()]
|
---|
| 130 | + "";
|
---|
| 131 | }
|
---|
| 132 |
|
---|
| 133 | public static String getLinesMoved() {
|
---|
| 134 | return _ItemStats[ItemType.Line.ordinal()][StatType.Moved.ordinal()]
|
---|
| 135 | + "";
|
---|
| 136 | }
|
---|
| 137 |
|
---|
| 138 | public static String getLinesDeleted() {
|
---|
| 139 | return _ItemStats[ItemType.Line.ordinal()][StatType.Deleted.ordinal()]
|
---|
| 140 | + "";
|
---|
| 141 | }
|
---|
| 142 |
|
---|
| 143 | public static String getLinesCopied() {
|
---|
| 144 | return _ItemStats[ItemType.Line.ordinal()][StatType.Copied.ordinal()]
|
---|
| 145 | + "";
|
---|
| 146 | }
|
---|
| 147 |
|
---|
| 148 | public static String getFrames() {
|
---|
| 149 | return _CreatedFrames + "";
|
---|
| 150 | }
|
---|
| 151 |
|
---|
| 152 | public static String getFramesCreated() {
|
---|
| 153 | return getFrames();
|
---|
| 154 | }
|
---|
| 155 |
|
---|
| 156 | public static String getEscapeCount() {
|
---|
| 157 | return _EscapeCount + "";
|
---|
| 158 | }
|
---|
| 159 |
|
---|
| 160 | public static String getBackspaceCount() {
|
---|
| 161 | return _BackspaceCount + "";
|
---|
| 162 | }
|
---|
| 163 |
|
---|
| 164 | public static String getLeftButtonCount() {
|
---|
[1102] | 165 | return _MouseCounters[KBMInputEvent.MouseButton.LEFT.ordinal()] + "";
|
---|
[427] | 166 | }
|
---|
| 167 |
|
---|
| 168 | public static String getMiddleButtonCount() {
|
---|
[1102] | 169 | return _MouseCounters[KBMInputEvent.MouseButton.MIDDLE.ordinal()] + "";
|
---|
[427] | 170 | }
|
---|
| 171 |
|
---|
| 172 | public static String getRightButtonCount() {
|
---|
[1102] | 173 | return _MouseCounters[KBMInputEvent.MouseButton.RIGHT.ordinal()] + "";
|
---|
[427] | 174 | }
|
---|
| 175 | }
|
---|