31.01.2014 Views

Version 5.0 The LEDA User Manual

Version 5.0 The LEDA User Manual

Version 5.0 The LEDA User Manual

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

15.3 Sets of Intervals ( interval set )<br />

1. Definition<br />

An instance S of the parameterized data type interval set is a collection of items<br />

(is item). Every item in S contains a closed interval of the double numbers as key and an<br />

information from data type I, called the information type of S. <strong>The</strong> number of items in<br />

S is called the size of S. An interval set of size zero is said to be empty. We use <br />

to denote the item with interval [x, y] and information i; x (y) is called the left (right)<br />

boundary of the item. For each interval [x, y] there is at most one item ∈ S.<br />

#include < <strong>LEDA</strong>/geo/interval set.h ><br />

2. Creation<br />

interval set S;<br />

creates an instance S of type interval set and initializes S to<br />

the empty set.<br />

3. Operations<br />

double S.left(is item it) returns the left boundary of item it.<br />

Precondition: it is an item in S.<br />

double S.right(is item it) returns the right boundary of item it.<br />

Precondition: it is an item in S.<br />

const I& S.inf(is item it) returns the information of item it.<br />

Precondition: it is an item in S.<br />

is item S.insert(double x, double y, const I& i)<br />

is item S.lookup(double x, double y)<br />

list const S.intersection(double a, double b)<br />

associates the information i with interval [x, y].<br />

If there is an item in S then j is replaced<br />

by i, else a new item is added<br />

to S. In both cases the item is returned.<br />

returns the item with interval [x, y] (nil if no such<br />

item exists in S).<br />

returns all items ∈ S with [x, y] ∩<br />

[a, b] ≠ ∅.<br />

void S.del(double x, double y) deletes the item with interval [x, y] from S.<br />

void S.del item(is item it) removes item it from S.<br />

Precondition: it is an item in S.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!