Many changes, bad commit message.
This commit is contained in:
parent
e4a3b967de
commit
f3a049777a
@ -7,9 +7,9 @@ import org.joda.time.Duration
|
||||
*/
|
||||
public abstract class Category implements Comparable<Category> {
|
||||
|
||||
public List<Event> events
|
||||
public List<Category> categories
|
||||
public List<CategorizationPlan> categorizationPlans
|
||||
public List events
|
||||
public List categories
|
||||
public List categorizationPlans
|
||||
public String description
|
||||
|
||||
public Category() {
|
||||
@ -28,7 +28,7 @@ public abstract class Category implements Comparable<Category> {
|
||||
|
||||
public abstract boolean matchesEvent(Event e)
|
||||
|
||||
public void addEvent(Event event) {
|
||||
public Event addEvent(Event event) {
|
||||
|
||||
// see if we have or can create a subcategory that will hold this event
|
||||
Event addedEvent = addToSubcategory(event)
|
||||
@ -42,7 +42,7 @@ public abstract class Category implements Comparable<Category> {
|
||||
return addedEvent
|
||||
}
|
||||
|
||||
public boolean addToSubcategory(Event e) {
|
||||
public Event addToSubcategory(Event e) {
|
||||
|
||||
// find all matching subcategories
|
||||
def matchingCategories = categories.findAll { it.matchesEvent(e) }
|
||||
@ -77,7 +77,7 @@ public abstract class Category implements Comparable<Category> {
|
||||
return null
|
||||
}
|
||||
|
||||
public Category filter(List<CategoryFilters> filters) {
|
||||
public Category filter(List<CategoryFilter> filters) {
|
||||
|
||||
// create new filtered category
|
||||
FilteredCategory fc = new FilteredCategory(description)
|
||||
|
@ -6,11 +6,11 @@ public class DescriptionBasedCategory extends Category {
|
||||
|
||||
public DescriptionBasedCategory(String description) {
|
||||
super()
|
||||
this.description = description
|
||||
this.description = description.replaceAll(/\p{Punct}/, '')
|
||||
}
|
||||
|
||||
public boolean matchesEvent(Event e) {
|
||||
return e.description == description
|
||||
return e.description.replaceAll(/\p{Punct}/, '') == description
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -10,7 +10,8 @@ public class Event implements Cloneable {
|
||||
public final String description
|
||||
public final String notes
|
||||
public final DateTime start
|
||||
public final Duration duration
|
||||
public Duration duration // bit of a hack, allows modification for the
|
||||
// TimelineEventProcessor
|
||||
|
||||
public static PeriodFormatter periodFormatter = PeriodFormat.getDefault()
|
||||
|
||||
|
@ -20,12 +20,11 @@ public class TimelineEventProcessor {
|
||||
List<Event> events = []
|
||||
|
||||
timeline.each { marker ->
|
||||
Event e = new Event()
|
||||
|
||||
e.description = marker.mark
|
||||
e.notes = marker.notes
|
||||
e.start = new DateTime(marker.timestamp)
|
||||
e.duration = new Duration(0)
|
||||
Event e = new Event(
|
||||
description: marker.mark,
|
||||
notes: marker.notes,
|
||||
start: new DateTime(marker.timestamp),
|
||||
duration: new Duration(0))
|
||||
|
||||
// if this is not the first event, then we need to update the
|
||||
// duration of the previous event
|
||||
|
@ -14,11 +14,11 @@ public class TwoLevelCategory extends Category {
|
||||
return e.description ==~ descriptionPattern
|
||||
}
|
||||
|
||||
public Entry addEvent(Event e) {
|
||||
public Event addEvent(Event e) {
|
||||
def m = e.description =~ descriptionPattern
|
||||
|
||||
e = new Event(e, description: m[0][1])
|
||||
|
||||
return super.addEvent(e)
|
||||
super.addEvent(e)
|
||||
}
|
||||
}
|
||||
|
@ -17,9 +17,8 @@ public class TicketCategory extends Category {
|
||||
return (e.description ==~ /.*#${ticketId}.*/)
|
||||
}
|
||||
|
||||
public TicketEvent addEvent(Event e) {
|
||||
TicketEvent te = new TicketEvent(this, e)
|
||||
public Event addEvent(Event e) {
|
||||
TicketEvent te = new TicketEvent(e)
|
||||
events << te
|
||||
return te
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ public class TicketEvent extends Event {
|
||||
|
||||
public TicketEvent(String desc, String notes, String start, String duration) {
|
||||
|
||||
super(desc, note, start, duration)
|
||||
super(desc, notes, start, duration)
|
||||
|
||||
def m = desc =~ /.*#(\d+).*/
|
||||
this.id = m[0][1] as int
|
||||
@ -27,4 +27,11 @@ public class TicketEvent extends Event {
|
||||
def m = description =~ /.*#(\d+).*/
|
||||
this.id = m[0][1] as int
|
||||
}
|
||||
|
||||
public TicketEvent(Event e) {
|
||||
super([:], e)
|
||||
|
||||
def m = description =~ /.*#(\d+).*/
|
||||
this.id = m[0][1] as int
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user