<commit_before>package org.owasp.appsensor.storage.memory;

import java.util.ArrayList;
import java.util.Collection;
import java.util.concurrent.CopyOnWriteArrayList;

import javax.inject.Named;

import org.joda.time.DateTime;
import org.owasp.appsensor.core.DetectionPoint;
import org.owasp.appsensor.core.Event;
import org.owasp.appsensor.core.User;
import org.owasp.appsensor.core.criteria.SearchCriteria;
import org.owasp.appsensor.core.listener.EventListener;
import org.owasp.appsensor.core.logging.Loggable;
import org.owasp.appsensor.core.storage.EventStore;
import org.owasp.appsensor.core.util.DateUtils;
import org.slf4j.Logger;

/**
 * This is a reference implementation of the {@link EventStore}.
 * 
 * Implementations of the {@link EventListener} interface can register with 
 * this class and be notified when new {@link Event}s are added to the data store 
 * 
 * The implementation is trivial and simply stores the {@link Event} in an in-memory collection.
 * 
 * @author <NAME> (<EMAIL>) http://www.jtmelton.com/
 * @author <NAME>
 */
@Named
@Loggable
public class InMemoryEventStore extends EventStore {
	
	private Logger logger;
	
	/** maintain a collection of {@link Event}s as an in-memory list */
	private Collection<Event> events = new CopyOnWriteArrayList<Event>();
	<commit_msg>set the events collection to be static to ensure we're working with a single collection - https://github.com/jtmelton/appsensor/issues/16<commit_after>package org.owasp.appsensor.storage.memory;

import java.util.ArrayList;
import java.util.Collection;
import java.util.concurrent.CopyOnWriteArrayList;

import javax.inject.Named;

import org.joda.time.DateTime;
import org.owasp.appsensor.core.DetectionPoint;
import org.owasp.appsensor.core.Event;
import org.owasp.appsensor.core.User;
import org.owasp.appsensor.core.criteria.SearchCriteria;
import org.owasp.appsensor.core.listener.EventListener;
import org.owasp.appsensor.core.logging.Loggable;
import org.owasp.appsensor.core.storage.EventStore;
import org.owasp.appsensor.core.util.DateUtils;
import org.slf4j.Logger;

/**
 * This is a reference implementation of the {@link EventStore}.
 * 
 * Implementations of the {@link EventListener} interface can register with 
 * this class and be notified when new {@link Event}s are added to the data store 
 * 
 * The implementation is trivial and simply stores the {@link Event} in an in-memory collection.
 * 
 * @author <NAME> (<EMAIL>) http://www.jtmelton.com/
 * @author <NAME>
 */
@Named
@Loggable
public class InMemoryEventStore extends EventStore {
	
	private Logger logger;
	
	/** maintain a collection of {@link Event}s as an in-memory list */
	private static Collection<Event> events = new CopyOnWriteArrayList<Event>();
	
{'fraction_non_alphanumeric': 0.10507114191900765, 'fraction_numerical': 0.001459321415541773, 'mean_word_length': 4.935064935064935, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 1, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2776352', 'n_tokens_mistral': 831, 'n_tokens_neox': 804, 'n_words': 232}