Added findEntriesToRecategorize() to CategorizationPlan Refactored createNewCategory() to newCategory() on CategorizationPlan Refactored Category to use CategorizationPlans Created CatPlan for DescriptionBasedCategory Made Event cloneable. Refactored Category implementations to be aware of the single arg Category constructor. Created TwoLevelCategory, for entries which inherently have two levels of categorization in them. Created a CatPlan for TwoLevelCategory Removed the specialization implementation, ITHelpCategory: the new TwoLevelCategory is a more general version of the same. Created CatPlan for TicketCategory Fixed TicketCategory and TicketPlan to adjust for small difference between the old behavour of ITHelpCategory and new TwoLevelCategory Updated testing starter script.
29 lines
593 B
Groovy
29 lines
593 B
Groovy
package com.jdbernard.timeanalyzer
|
|
|
|
public class TwoLevelCategory extends Category {
|
|
|
|
private final def descriptionPattern
|
|
|
|
public TwoLevelCategory(String heading) {
|
|
super(heading)
|
|
|
|
descriptionPattern = ~/^${heading}:\s*(.*)/
|
|
}
|
|
|
|
public boolean matchesEvent(Event e) {
|
|
return e.description ==~ descriptionPattern
|
|
}
|
|
|
|
public Entry addEvent(Event e) {
|
|
def event = e.clone()
|
|
|
|
def m = event.description =~ descriptionPattern
|
|
|
|
event.description = m[0][1]
|
|
|
|
def entry = super.addEvent(event)
|
|
|
|
return entry
|
|
}
|
|
}
|