All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sf.exlp.event.handler.EhResultContainer Maven / Gradle / Ivy

There is a newer version: 0.1.17
Show newest version
package net.sf.exlp.event.handler;

import java.util.ArrayList;
import java.util.NoSuchElementException;

import net.sf.exlp.event.AbstractEventHandler;
import net.sf.exlp.event.LogEvent;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class EhResultContainer extends AbstractEventHandler 
{
	final static Logger logger = LoggerFactory.getLogger(EhResultContainer.class);
	
	static final long serialVersionUID=1;
	
	private ArrayList alResults;

	public EhResultContainer()
	{
		alResults = new ArrayList();
	}

	public boolean handleEvent(LogEvent event)
	{
		count();
		alResults.add(event);
		return true;
	}
	
	public ArrayList getAlResults() {return alResults;}
	
	public LogEvent getSingleResult()
	{
		if(alResults.size()>0){return alResults.get(0);}
		else
		{
			throw new NoSuchElementException("No "+LogEvent.class.getSimpleName()+" in container.");
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy