org.eclipse.mylar.internal.monitor.reports.collectors
Class MylarUsageAnalysisCollector

java.lang.Object
  extended by org.eclipse.mylar.monitor.reports.DelegatingUsageCollector
      extended by org.eclipse.mylar.internal.monitor.reports.collectors.AbstractMylarUsageCollector
          extended by org.eclipse.mylar.internal.monitor.reports.collectors.MylarUsageAnalysisCollector
All Implemented Interfaces:
IUsageCollector

public class MylarUsageAnalysisCollector
extends AbstractMylarUsageCollector

Delagates to other collectors for additional info.

Author:
Mik Kersten

Field Summary
static int BASELINE_EDITS_THRESHOLD
           
private  java.util.Map<java.lang.Integer,java.lang.Integer> baselineCurrentNumSelectionsBeforeEdit
           
private  java.util.Map<java.lang.Integer,java.lang.Integer> baselineEdits
           
private  java.util.Map<java.lang.Integer,java.lang.Integer> baselineSelections
           
private  java.util.Map<java.lang.Integer,java.lang.Integer> baselineTotalEditsCounted
           
private  java.util.Map<java.lang.Integer,java.lang.Integer> baselineTotalSelectionsBeforeEdit
           
private  java.util.Map<java.lang.Integer,java.util.Date> endDates
           
private  java.util.Map<java.lang.Integer,org.eclipse.mylar.context.core.InteractionEvent> lastUserEvent
           
private static int MYLAR_EDITS_THRESHOLD
           
private  java.util.Map<java.lang.Integer,java.lang.Integer> mylarCurrentNumSelectionsBeforeEdit
           
private  java.util.Map<java.lang.Integer,java.lang.Integer> mylarEdits
           
private  java.util.Map<java.lang.Integer,java.lang.Integer> mylarInactiveEdits
           
private  java.util.Map<java.lang.Integer,java.lang.Integer> mylarInactiveSelections
           
private  java.util.Map<java.lang.Integer,java.lang.Integer> mylarSelections
           
private  java.util.Map<java.lang.Integer,java.lang.Integer> mylarTotalEditsCounted
           
private  java.util.Map<java.lang.Integer,java.lang.Integer> mylarTotalSelectionsBeforeEdit
           
private static int NUM_VIEWS_REPORTED
           
private  java.util.Map<java.lang.Integer,java.lang.Integer> numMylarActiveJavaEdits
           
private  java.util.Map<java.lang.Integer,java.util.Date> startDates
           
private  float summaryEditRatioDelta
           
private  java.util.Map<java.lang.Integer,java.lang.Long> timeBaseline
           
private  java.util.Map<java.lang.Integer,java.lang.Long> timeMylarActive
           
private  java.util.Map<java.lang.Integer,java.lang.Long> timeMylarInactive
           
private  java.util.List<java.lang.Integer> usersDegraded
           
private  java.util.List<java.lang.Integer> usersImproved
           
private  MylarViewUsageCollector viewUsageCollector
           
 
Fields inherited from class org.eclipse.mylar.internal.monitor.reports.collectors.AbstractMylarUsageCollector
commandUsageCollector, mylarInactiveUserIds, mylarUserIds, userIds
 
Fields inherited from class org.eclipse.mylar.monitor.reports.DelegatingUsageCollector
scanners
 
Constructor Summary
MylarUsageAnalysisCollector()
           
 
Method Summary
 boolean acceptUser(int id)
           
private  void accumulateDuration(org.eclipse.mylar.context.core.InteractionEvent event, int userId, java.util.Map<java.lang.Integer,java.lang.Long> timeAccumulator)
           
 void consumeEvent(org.eclipse.mylar.context.core.InteractionEvent event, int userId)
          Overriders must call super.consumeEvent(..)
 void exportAsCSVFile(java.lang.String directory)
          Implementors will need to generate a unique filename given the directory in which to place the file
 float getBaselineRatio(int id)
          Public for testing.
private  float getEditRatio(int id, java.util.Map<java.lang.Integer,java.lang.Integer> edits, java.util.Map<java.lang.Integer,java.lang.Integer> selections)
           
 java.lang.String getEndDate(int id)
           
 float getMylarInactiveRatio(int id)
           
 float getMylarRatio(int id)
          Public for testing.
 int getNumBaselineEdits(int id)
           
 int getNumBaselineSelections(int id)
           
 int getNumInactiveEdits(int id)
           
 int getNumMylarEdits(int id)
           
 int getNumMylarInactiveEdits(int id)
           
 int getNumMylarInactiveSelections(int id)
           
 int getNumMylarSelections(int id)
           
 java.util.List<java.lang.String> getReport()
          TODO: return report as HTML
 java.lang.String getReportTitle()
           
 java.lang.String getStartDate(int id)
           
private  java.lang.String getTime(int id, java.util.Map<java.lang.Integer,java.lang.Long> timeMap)
           
private  void incrementCount(int userId, java.util.Map<java.lang.Integer,java.lang.Integer> map)
           
private  void incrementCount(int userId, java.util.Map<java.lang.Integer,java.lang.Integer> map, int count)
           
static boolean isEdit(org.eclipse.mylar.context.core.InteractionEvent event)
           
static boolean isJavaEdit(org.eclipse.mylar.context.core.InteractionEvent event)
           
static boolean isSelection(org.eclipse.mylar.context.core.InteractionEvent event)
           
static boolean isSelectionInEditor(org.eclipse.mylar.context.core.InteractionEvent event)
           
 
Methods inherited from class org.eclipse.mylar.monitor.reports.DelegatingUsageCollector
addScanner, getDelegates, setDelegates, setReportTitle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BASELINE_EDITS_THRESHOLD

public static final int BASELINE_EDITS_THRESHOLD
See Also:
Constant Field Values

MYLAR_EDITS_THRESHOLD

private static final int MYLAR_EDITS_THRESHOLD
See Also:
Constant Field Values

NUM_VIEWS_REPORTED

private static final int NUM_VIEWS_REPORTED
See Also:
Constant Field Values

summaryEditRatioDelta

private float summaryEditRatioDelta

usersImproved

private final java.util.List<java.lang.Integer> usersImproved

usersDegraded

private final java.util.List<java.lang.Integer> usersDegraded

startDates

private java.util.Map<java.lang.Integer,java.util.Date> startDates

numMylarActiveJavaEdits

private java.util.Map<java.lang.Integer,java.lang.Integer> numMylarActiveJavaEdits

endDates

private java.util.Map<java.lang.Integer,java.util.Date> endDates

baselineSelections

private java.util.Map<java.lang.Integer,java.lang.Integer> baselineSelections

baselineEdits

private java.util.Map<java.lang.Integer,java.lang.Integer> baselineEdits

mylarInactiveSelections

private java.util.Map<java.lang.Integer,java.lang.Integer> mylarInactiveSelections

mylarInactiveEdits

private java.util.Map<java.lang.Integer,java.lang.Integer> mylarInactiveEdits

mylarSelections

private java.util.Map<java.lang.Integer,java.lang.Integer> mylarSelections

mylarEdits

private java.util.Map<java.lang.Integer,java.lang.Integer> mylarEdits

baselineCurrentNumSelectionsBeforeEdit

private java.util.Map<java.lang.Integer,java.lang.Integer> baselineCurrentNumSelectionsBeforeEdit

baselineTotalSelectionsBeforeEdit

private java.util.Map<java.lang.Integer,java.lang.Integer> baselineTotalSelectionsBeforeEdit

baselineTotalEditsCounted

private java.util.Map<java.lang.Integer,java.lang.Integer> baselineTotalEditsCounted

mylarCurrentNumSelectionsBeforeEdit

private java.util.Map<java.lang.Integer,java.lang.Integer> mylarCurrentNumSelectionsBeforeEdit

mylarTotalSelectionsBeforeEdit

private java.util.Map<java.lang.Integer,java.lang.Integer> mylarTotalSelectionsBeforeEdit

mylarTotalEditsCounted

private java.util.Map<java.lang.Integer,java.lang.Integer> mylarTotalEditsCounted

lastUserEvent

private java.util.Map<java.lang.Integer,org.eclipse.mylar.context.core.InteractionEvent> lastUserEvent

timeMylarActive

private java.util.Map<java.lang.Integer,java.lang.Long> timeMylarActive

timeMylarInactive

private java.util.Map<java.lang.Integer,java.lang.Long> timeMylarInactive

timeBaseline

private java.util.Map<java.lang.Integer,java.lang.Long> timeBaseline

viewUsageCollector

private MylarViewUsageCollector viewUsageCollector
Constructor Detail

MylarUsageAnalysisCollector

public MylarUsageAnalysisCollector()
Method Detail

getReportTitle

public java.lang.String getReportTitle()
Specified by:
getReportTitle in interface IUsageCollector
Overrides:
getReportTitle in class DelegatingUsageCollector

consumeEvent

public void consumeEvent(org.eclipse.mylar.context.core.InteractionEvent event,
                         int userId)
Description copied from class: AbstractMylarUsageCollector
Overriders must call super.consumeEvent(..)

Specified by:
consumeEvent in interface IUsageCollector
Overrides:
consumeEvent in class AbstractMylarUsageCollector

accumulateDuration

private void accumulateDuration(org.eclipse.mylar.context.core.InteractionEvent event,
                                int userId,
                                java.util.Map<java.lang.Integer,java.lang.Long> timeAccumulator)

isEdit

public static boolean isEdit(org.eclipse.mylar.context.core.InteractionEvent event)

isSelection

public static boolean isSelection(org.eclipse.mylar.context.core.InteractionEvent event)

isSelectionInEditor

public static boolean isSelectionInEditor(org.eclipse.mylar.context.core.InteractionEvent event)

isJavaEdit

public static boolean isJavaEdit(org.eclipse.mylar.context.core.InteractionEvent event)

incrementCount

private void incrementCount(int userId,
                            java.util.Map<java.lang.Integer,java.lang.Integer> map,
                            int count)

incrementCount

private void incrementCount(int userId,
                            java.util.Map<java.lang.Integer,java.lang.Integer> map)

getReport

public java.util.List<java.lang.String> getReport()
Description copied from interface: IUsageCollector
TODO: return report as HTML

Specified by:
getReport in interface IUsageCollector
Overrides:
getReport in class DelegatingUsageCollector
Returns:
a list corresponding to all of the lines of the report

exportAsCSVFile

public void exportAsCSVFile(java.lang.String directory)
Description copied from interface: IUsageCollector
Implementors will need to generate a unique filename given the directory in which to place the file

Specified by:
exportAsCSVFile in interface IUsageCollector
Overrides:
exportAsCSVFile in class DelegatingUsageCollector

getTime

private java.lang.String getTime(int id,
                                 java.util.Map<java.lang.Integer,java.lang.Long> timeMap)

acceptUser

public boolean acceptUser(int id)

getStartDate

public java.lang.String getStartDate(int id)

getEndDate

public java.lang.String getEndDate(int id)

getNumBaselineSelections

public int getNumBaselineSelections(int id)

getNumBaselineEdits

public int getNumBaselineEdits(int id)

getNumMylarEdits

public int getNumMylarEdits(int id)

getNumMylarInactiveEdits

public int getNumMylarInactiveEdits(int id)

getNumInactiveEdits

public int getNumInactiveEdits(int id)

getNumMylarInactiveSelections

public int getNumMylarInactiveSelections(int id)

getNumMylarSelections

public int getNumMylarSelections(int id)

getBaselineRatio

public float getBaselineRatio(int id)
Public for testing.


getMylarInactiveRatio

public float getMylarInactiveRatio(int id)

getMylarRatio

public float getMylarRatio(int id)
Public for testing.


getEditRatio

private float getEditRatio(int id,
                           java.util.Map<java.lang.Integer,java.lang.Integer> edits,
                           java.util.Map<java.lang.Integer,java.lang.Integer> selections)