% Play with the Interval class
clear all
clc

p= Interval(3,7) % p references a newly created Interval object

pause
disp('Make the interval twice as wide and then shift it left by one unit')
p.scale(2)
disp(p)
p.shift(-1)
disp(p)

pause
fprintf('\nLet q reference the same interval as p\n')
q= p; % q and p both reference (point to) the same interval.
% Note that so far we have only ONE interval object, referenced
% by both p and q.
disp('Shift the interval referenced by q to the right 3 units')
q.shift(3)
disp(q)
pause
disp('See the properties of the interval referenced by p')
disp(p)
disp('p and q reference the SAME object!')

pause
fprintf('\nCreate a second and third interval objects\n')
r= Interval(4,9)
s= Interval(0,1)

pause
fprintf('\nOverlap intervals p and r\n')
a= p.overlap(r)
pause
fprintf('\nOverlap intervals p and s\n')
b= p.overlap(s)