/* ----------------------------------------
 * Origin  : GFI INFORMATIQUE 
 * Project : CDPP Propagation Tool 
 * ----------------------------------------
 * History 
 * Version : 01/05/2015 : SCA : V2.1
 * ----------------------------------------
 */
package fr.tlse.irap.fit;

import java.util.ArrayList;
import java.util.List;

import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;

@XmlRootElement
public class FitPointWrapper {

	private List<FitPoint> fitPoints;

	public FitPointWrapper() {
		fitPoints = new ArrayList<FitPoint>();
	}

	public FitPointWrapper(List<FitPoint> fitPoints) {
		this.fitPoints = fitPoints;
	}

	@XmlElement(name="fitPoints")
	public List<FitPoint> getFitPoints() {
		return fitPoints;
	}

	public void setFitPoints(List<FitPoint> fitPoints) {
		this.fitPoints = fitPoints;
	}

//	public FitPoint getNearestFromTime(Calendar calendar) {
//
//		FitPoint previous = (fitPoints.isEmpty() ? null : fitPoints.get(0));
//		FitPoint next = null;
//
//		for (FitPoint fitPoint : this.fitPoints) {
//			if (fitPoint.getEventTime().after(calendar)) {
//				next = fitPoint;
//				break;
//			}
//			previous = fitPoint;
//		}
//
//		if (next == null)
//			return previous;
//		else {
//			Long deltaPrevious = Math.abs(previous.getEventTime()
//					.getTimeInMillis() - calendar.getTimeInMillis());
//			Long deltaNext = Math.abs(next.getEventTime().getTimeInMillis()
//					- calendar.getTimeInMillis());
//			return (deltaPrevious < deltaNext ? previous : next);
//		}
//	}
}
