Re: [tracecompass-dev] Segmentstore intersection (inclusive or exclusive)

Hi Matthew,

Shouldn't (-1,3) intersect with (0,2)?

I'm not sure that querying a range should be done by merging the results of the intersection with adjacent sub-ranges.

If you have only one segment (1,4), then intersection with (0,5) is the segment (1,4), but intersection with (0,1)+(1,2)+(2,3)+(3,4)+(4,5) is either 3x, 4x or 5x the same segment (1,4) depending on if you treat boundaries inclusive or exclusive.

So if your only interface to the segment store is the intersection function, you'll have to manually filter out the results of each iteration to avoid duplications, and then you can decide if you want to include or exclude the end bound.

Patrick

On Fri, Jul 3, 2015 at 1:54 PM, Matthew Khouzam wrote:
Hi all, I want to discuss a bit the design or the statesystem segement
store.

Right now the get intersection is inclusive/inclusive, I would propose
that it should be inclusive/exclusive.

So here are some test cases

philosophical test cases
query range,  segment, included?

infinity, infinity, yes
finite, infinity, no
infinity, finite, yes

specific test cases
query range,  segment, included?

(0,2) , (-1,-1), no
(0,2) , (-1,0), yes
(0,2) , (-1,2), yes
(0,2) , (-1,2), yes
(0,2) , (-1,3), no
(0,2) , (0,0), yes
(0,2) , (0,1), yes
(0,2) , (0,2), yes
(0,2) , (0,3), yes
(0,2) , (1,1), yes
(0,2) , (1,2), yes
(0,2) , (1,3), yes
(0,2) , (2,2), yes*
(0,2) , (2,3), yes*
(0,2) , (3,3), no
(0,2) , (3,4), no

The results noted with a star (*) are the ones I would propose changing.
The reasoning, being that it will make iteration much simpler. It is
much more intuitive to say for example, give me everything between t1
and t2, now t2 and t3...

The patch is easy to do, but I want to make sure we are on the same page
for this.

Why would this be important? We will use the segment store to show
cumulative information too, so it we query between 0 and 5 and the
number of segments is different from querying from 0 to 1, 1 to 2, 2 to
3, and 3 to 4. As we can have two identical segments in a store (not
impossible) this will be much harder to manage than using an inclusive
exclusive scheme. This pattern will allow iterating over the segment's
dimension, e.g. time.

On a final note, one of my colleagues asked a really good question, does
Game of Thrones play from 9:00 to 10:00 or 9:00 to 9:59:59.999? I vote
for 9:00 to 10:00.

Thoughts?

Matthew
_______________________________________________
tracecompass-dev mailing list
tracecompass-dev@xxxxxxxxxxx