version 3.3

VRS::SimpleRange Class Reference

a class to handle ranges with included or excluded bounds ([a, b], [a, b[, etc. More...

#include <vrs/range.h>

List of all members.

Public Types

enum  RangeMode { COMPACT = 0, RIGHT_EXCLUDED = 1, LEFT_EXCLUDED = 2, EXCLUDED = 3 }

Public Member Functions

 SimpleRange (double left=0.0, double right=0.0, unsigned int mode=COMPACT)
 SimpleRange (double value)
 SimpleRange (const SimpleRange &other)
bool operator== (const SimpleRange &other) const
bool operator!= (const SimpleRange &other) const
SimpleRangeoperator= (const SimpleRange &other)
bool isEmpty () const
 an empty range's upper and lower bounds are equal and its mode is different from COMPACT (at least one bound is included).
SimpleRange operator & (const SimpleRange &other) const
 calculate intersection of two overlapping SimpleRanges.
SimpleRangeoperator &= (const SimpleRange &other)
SimpleRange operator| (const SimpleRange &other) const
 calculate union of two overlapping SimpleRanges.
SimpleRangeoperator|= (const SimpleRange &other)
bool isRightExcluded () const
 is the particular bound excluded?
bool isLeftExcluded () const
bool contains (double value) const
 check whether a range (fully) contains a point or another range
bool contains (const SimpleRange &other) const
bool isContained (const SimpleRange &other) const
bool overlaps (const SimpleRange &other) const
 checks whether two SimpleRanges overlap, that is the ranges share at least one point overlapping includes containment.
unsigned int mode () const
 return the range's mode
Bound lowerBound () const
 lower and upper bound.
Bound upperBound () const
bool shareBounds (const SimpleRange &other) const
 returns true if the upper bound of the left range is equal to the lower bound of the right range and at least one bound is not excluded examples: .
double length () const
const double & first () const
 return the lower (first) and upper (second) bounds' values
const double & second () const
bool expandTo (const Bound &b)
 expand the range to contain b
bool hasSmallerLeft (const SimpleRange &other) const
 returns whether the local left is smaller or equal (!) to the other left value.
bool hasLargerLeft (const SimpleRange &other) const
 returns whether the local left is larger or equal (!) to the other left value.
bool hasSmallerRight (const SimpleRange &other) const
 returns whether the local right is smaller or equal (!) to the other right value.
bool hasLargerRight (const SimpleRange &other) const
 returns whether the local right is larger or equal (!) to the other right value.
SimpleRange operator+ (double value) const
 adding/subtracting values will increase/decrease the upper and lower bounds by the same value.
SimpleRange operator- (double value) const
SimpleRangeoperator+= (double value)
SimpleRangeoperator-= (double value)
SimpleRange operator+ (const SimpleRange &range) const
SimpleRange operator- (const SimpleRange &range) const
SimpleRangeoperator+= (const SimpleRange &range)
SimpleRangeoperator-= (const SimpleRange &range)
 VRS_SERIALIZABLE_NO_SO_CLASS (SimpleRange)

Static Public Attributes

static SimpleRange empty

Classes

struct  Bound


Detailed Description

a class to handle ranges with included or excluded bounds ([a, b], [a, b[, etc.

) ranges support addition and subtraction.


Member Enumeration Documentation

Enumerator:
COMPACT 
RIGHT_EXCLUDED 
LEFT_EXCLUDED 
EXCLUDED 


Constructor & Destructor Documentation

VRS::SimpleRange::SimpleRange ( double  left = 0.0,
double  right = 0.0,
unsigned int  mode = COMPACT 
)

VRS::SimpleRange::SimpleRange ( double  value  ) 

VRS::SimpleRange::SimpleRange ( const SimpleRange other  ) 


Member Function Documentation

bool VRS::SimpleRange::operator== ( const SimpleRange other  )  const

bool VRS::SimpleRange::operator!= ( const SimpleRange other  )  const

SimpleRange& VRS::SimpleRange::operator= ( const SimpleRange other  ) 

bool VRS::SimpleRange::isEmpty (  )  const

an empty range's upper and lower bounds are equal and its mode is different from COMPACT (at least one bound is included).

SimpleRange VRS::SimpleRange::operator & ( const SimpleRange other  )  const

calculate intersection of two overlapping SimpleRanges.

If the ranges do not intersect, the returned range is empty.

SimpleRange& VRS::SimpleRange::operator &= ( const SimpleRange other  ) 

SimpleRange VRS::SimpleRange::operator| ( const SimpleRange other  )  const

calculate union of two overlapping SimpleRanges.

If the ranges do not intersect, the returned range is empty.

SimpleRange& VRS::SimpleRange::operator|= ( const SimpleRange other  ) 

bool VRS::SimpleRange::isRightExcluded (  )  const

is the particular bound excluded?

bool VRS::SimpleRange::isLeftExcluded (  )  const

bool VRS::SimpleRange::contains ( double  value  )  const

check whether a range (fully) contains a point or another range

bool VRS::SimpleRange::contains ( const SimpleRange other  )  const

bool VRS::SimpleRange::isContained ( const SimpleRange other  )  const

bool VRS::SimpleRange::overlaps ( const SimpleRange other  )  const

checks whether two SimpleRanges overlap, that is the ranges share at least one point overlapping includes containment.

unsigned int VRS::SimpleRange::mode (  )  const [inline]

return the range's mode

Bound VRS::SimpleRange::lowerBound (  )  const

lower and upper bound.

the returned modes are only COMPACT or EXCLUDED, upper and lower bounds are not distinguished.

Bound VRS::SimpleRange::upperBound (  )  const

bool VRS::SimpleRange::shareBounds ( const SimpleRange other  )  const

returns true if the upper bound of the left range is equal to the lower bound of the right range and at least one bound is not excluded examples: .

..left][right... returns true ...left[]right... returns false as the ranges are separated by the point [p], p == left == right ...left[[right... returns true ...left]]right... returns true

double VRS::SimpleRange::length (  )  const [inline]

const double& VRS::SimpleRange::first (  )  const [inline]

return the lower (first) and upper (second) bounds' values

const double& VRS::SimpleRange::second (  )  const [inline]

bool VRS::SimpleRange::expandTo ( const Bound b  ) 

expand the range to contain b

bool VRS::SimpleRange::hasSmallerLeft ( const SimpleRange other  )  const

returns whether the local left is smaller or equal (!) to the other left value.

bool VRS::SimpleRange::hasLargerLeft ( const SimpleRange other  )  const

returns whether the local left is larger or equal (!) to the other left value.

bool VRS::SimpleRange::hasSmallerRight ( const SimpleRange other  )  const

returns whether the local right is smaller or equal (!) to the other right value.

bool VRS::SimpleRange::hasLargerRight ( const SimpleRange other  )  const

returns whether the local right is larger or equal (!) to the other right value.

SimpleRange VRS::SimpleRange::operator+ ( double  value  )  const

adding/subtracting values will increase/decrease the upper and lower bounds by the same value.

adding/subtracting SimpleRanges will add/subtract the right range's upper bound to/from the left range's upper bound and the right range's lower bound to/from the left range's lower bound (it's NOT interval arithmetic)

SimpleRange VRS::SimpleRange::operator- ( double  value  )  const

SimpleRange& VRS::SimpleRange::operator+= ( double  value  ) 

SimpleRange& VRS::SimpleRange::operator-= ( double  value  ) 

SimpleRange VRS::SimpleRange::operator+ ( const SimpleRange range  )  const

SimpleRange VRS::SimpleRange::operator- ( const SimpleRange range  )  const

SimpleRange& VRS::SimpleRange::operator+= ( const SimpleRange range  ) 

SimpleRange& VRS::SimpleRange::operator-= ( const SimpleRange range  ) 

VRS::SimpleRange::VRS_SERIALIZABLE_NO_SO_CLASS ( SimpleRange   ) 


Member Data Documentation


The documentation for this class was generated from the following file:

Generated on Tue May 22 06:00:27 2012 by Doxygen 1.5.6
© 2001-2010 Hasso-Plattner-Institut | Impressum | Contact