/** * Compute average iteself. * * @return */ public double getAverageDuration() { long totalDuration = 0; for(Event evt : this) { totalDuration+= evt.getDuration(); } return totalDuration / size(); }
/** {@inheritDoc} */ @Override public EventSeries getAuditTrail(EventQueryDefinition query) { return new EventSeries(); }
/** * Event generation. * * @param uid * target unique identifier * @return unique event */ protected Event generateFeatureUsageEvent(String uid) { return new Event(SOURCE_JAVA, TARGET_FEATURE, uid, ACTION_CHECK_OK); }
/** * Match Event. * * @param evt * current event over this query * @return * if event is valid */ public boolean match(Event evt) { return (evt.getTimestamp() >= from) && (evt.getTimestamp() <= to) && matchAction(evt.getAction()) && matchSource(evt.getSource()) && matchHost(evt.getHostName()) && matchName(evt.getName()); }
public EventBuilder action(String action) { event.setAction(action); return this; }
public EventBuilder duration(long duration) { event.setDuration(duration); return this; }
/** * Init a new builder; * * @return * new builder */ private EventBuilder builder(String action) { return new EventBuilder(ff4j).type(TARGET_PROPERTY).action(action); }
/** {@inheritDoc} */ @Override public String toString() { return toJson(); }
public EventBuilder type(String type) { event.setType(type); return this; }
public EventBuilder value(String val) { event.setValue(val); return this; }
public EventBuilder name(String name) { event.setName(name); return this; }
/** * Shuts down the event publisher if we actually started it (As opposed to * having it dependency-injected). */ public void stop() { if (this.eventPublisher != null && this.shutdownEventPublisher) { this.eventPublisher.stop(); } }
/** {@inheritDoc} */ @Override public EventSeries searchFeatureUsageEvents(EventQueryDefinition query) { return new EventSeries(); }
/** * Default constructor. */ public EventBuilder() { this.event = new Event(); }
/** * Init a new builder; * * @return * new builder */ private EventBuilder builder(String action) { return new EventBuilder(ff4j).type(TARGET_FEATURE).action(action); }