Commit b775543e authored by Vlad Dumitru's avatar Vlad Dumitru
Browse files

fix temporary order reversal bug

parent b19d5f35
......@@ -8,6 +8,11 @@ module Data = struct
| Intervals of Interval.t list
| Points of Point.t list
let pp ppf =
function
| Intervals is -> Fmt.(list ~sep:comma Interval.pp) ppf is
| Points ps -> Fmt.(list ~sep:comma Point.pp) ppf ps
let of_points ps = Points ps
let of_intervals is = Intervals is
......@@ -44,7 +49,7 @@ module Data = struct
| Intervals is ->
let rec loop last_timestamp acc is =
begin match is with
| [] -> acc
| [] -> List.rev acc
| ((xmin, xmax), text) :: is ->
if Int64.(last_timestamp < xmin)
then loop xmax (((last_timestamp, xmin), "") :: ((xmin, xmax), text) :: acc) is
......@@ -201,6 +206,22 @@ type t =
; data : Data.t
}
let name t = t.name
let left t = fst t.bounds
let right t = snd t.bounds
let bounds t = t.bounds
let data t = t.data
let length t = Data.length t.data
let pp =
let open Fmt in
record
[ field "name" name string
; field "bounds" bounds (pair ~sep:(any " ") int64 int64)
; field "data" data Data.pp
]
type 'el error = [ `Overlap of 'el * 'el ]
......@@ -213,14 +234,6 @@ let equal x y =
let name t = t.name
let left t = fst t.bounds
let right t = snd t.bounds
let bounds t = t.bounds
let data t = t.data
let length t = Data.length t.data
let of_points ~name ?bounds points =
let data = Data.of_points points in
let bounds = match bounds with Some b -> b | None -> Data.bounds data
......
......@@ -8,6 +8,7 @@ module Data : sig
| Intervals of Interval.t list
| Points of Point.t list
include Pretty_printer.S with type t := t
include Equal.S with type t := t
val length : t -> int
......@@ -66,6 +67,8 @@ val data : t -> Data.t
val length : t -> int
include Pretty_printer.S with type t := t
val of_points
: name:string -> ?bounds:(int64 * int64) -> Point.t list
-> t
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment