class DataSync {

	public synchronized void add(final long timestamp, final T data)
	{
		DataStore store = new DataStore(timestamp, data);
		if (!buffer.isEmpty() && timestamp < buffer.get(0).getTimestamp())
		{
			log.debug("Clearing buffer, since incoming timestamp is smaller than buffered timestamp ({} < {})", timestamp,
					buffer.get(0).getTimestamp());
			buffer.clear();
		}
		buffer.removeIf(d -> d.timestamp < timestamp - horizon);
		buffer.add(store);
	}

	public  DataSync(final double horizon);

}