com.codetaco.funnel.FunnelItem Maven / Gradle / Ivy
package com.codetaco.funnel;
import java.io.IOException;
import java.text.ParseException;
import com.codetaco.funnel.segment.SourceProxyRecord;
/**
*
* FunnelItem class.
*
*
* @author Chris DeGreef [email protected]
*/
public class FunnelItem
{
FunnelDataProvider provider;
SourceProxyRecord data;
boolean endOfData;
long phase;
/**
*
* Getter for the field data
.
*
*
* @return a {@link com.codetaco.funnel.segment.SourceProxyRecord} object.
*/
public SourceProxyRecord getData()
{
return data;
}
/**
*
* Getter for the field phase
.
*
*
* @return a long.
*/
public long getPhase()
{
return phase;
}
/**
*
* Getter for the field provider
.
*
*
* @return a {@link com.codetaco.funnel.FunnelDataProvider} object.
*/
public FunnelDataProvider getProvider()
{
return provider;
}
/**
*
* isEndOfData.
*
*
* @return a boolean.
*/
public boolean isEndOfData()
{
return endOfData;
}
/**
*
* next.
*
*
* @param _phase a long.
* @return a boolean.
* @throws java.io.IOException if any.
* @throws java.text.ParseException if any.
*/
public boolean next(final long _phase) throws IOException, ParseException
{
if (!provider.next(this, _phase))
{
this.setEndOfData(true);
return false;
}
return true;
}
/**
*
* reset.
*
*/
public void reset()
{
data = null;
endOfData = false;
phase = -1;
}
/**
*
* Setter for the field data
.
*
*
* @param _data a {@link com.codetaco.funnel.segment.SourceProxyRecord}
* object.
*/
public void setData(final SourceProxyRecord _data)
{
this.data = _data;
}
/**
*
* Setter for the field endOfData
.
*
*
* @param _endOfData a boolean.
*/
public void setEndOfData(final boolean _endOfData)
{
this.endOfData = _endOfData;
}
/**
*
* Setter for the field phase
.
*
*
* @param _phase a long.
*/
public void setPhase(final long _phase)
{
this.phase = _phase;
}
/**
*
* Setter for the field provider
.
*
*
* @param _provider a {@link com.codetaco.funnel.FunnelDataProvider} object.
*/
public void setProvider(final FunnelDataProvider _provider)
{
this.provider = _provider;
}
/** {@inheritDoc} */
@Override
public String toString()
{
final StringBuilder sb = new StringBuilder();
sb.append(provider.getClass().getSimpleName());
sb.append(" dat=").append(data == null
? "null"
: data.hashCode());
sb.append(" eod=").append(endOfData);
sb.append(" pha=").append(phase);
return sb.toString();
}
}