package nl.ovapi.rid.model;

import java.util.ArrayList;

import lombok.Getter;
import lombok.NonNull;

public class Block {

	@Getter private ArrayList<Journey> segments;
	@Getter private String blockRef;
	
	public Block(String blockRef){
		segments = new ArrayList<Journey>();
		this.blockRef = blockRef;
	}
		
	public void addJourney(Journey journey){
		if (journey.getBlockRef() != blockRef && !blockRef.equals(journey.getBlockRef())){
			throw new IllegalArgumentException("Journey not part of this block");
		}
		segments.add(journey);
	}
}

@@ -303,16 +303,188 @@
 Ref;%0A%09%7D%0A
+%09%0A%09public long getDepartureEpoch()%7B%0A%09%09return segments.get(0).getDepartureEpoch();%0A%09%7D%0A%09%0A%09public long getEndEpoch()%7B%0A%09%09return segments.get(segments.size()).getEndEpoch();%0A%09%7D%0A
 %09%09%0A%09publ

Return min/max time of blocks