Timetabler
Public Member Functions | List of all members
Segment Class Reference

Class for segment. More...

#include <segment.h>

Inheritance diagram for Segment:
Inheritance graph
[legend]
Collaboration diagram for Segment:
Collaboration graph
[legend]

Public Member Functions

 Segment (int, int)
 Constructs the Segment object. More...
 
bool operator== (const Segment &other)
 Checks if two segment objects are identical, which is if their start and end segments are identical. More...
 
int length ()
 Gets the length of the Segment, which is the number of segment units it represents. For example, the length of the Segment 16 is 6. More...
 
bool isIntersecting (const Segment &other)
 Determines if two Segments are intersecting. Two segments are said to be intersecting if they contain a common segment unit. For example, 14 and 36 are intersecting, while 12 and 36 are not. More...
 
FieldType getType ()
 Gets the type under the FieldType enum. More...
 
std::string getName ()
 Gets the name of the Segment. The name is a string that concatenates the start and end segment values. For example, the name of 16 is "16". More...
 
std::string getTypeName ()
 Gets the type name, which is "Segment". More...
 

Detailed Description

Class for segment.

Constructor & Destructor Documentation

Segment::Segment ( int  startSegment,
int  endSegment 
)

Constructs the Segment object.

Parameters
[in]startSegmentThe start segment
[in]endSegmentThe end segment

Member Function Documentation

std::string Segment::getName ( )

Gets the name of the Segment. The name is a string that concatenates the start and end segment values. For example, the name of 16 is "16".

Returns
The name
FieldType Segment::getType ( )
virtual

Gets the type under the FieldType enum.

Returns
A member of the FieldType enum, which is FieldType::segment

Implements Field.

std::string Segment::getTypeName ( )
virtual

Gets the type name, which is "Segment".

Returns
The string "Segment"

Implements Field.

bool Segment::isIntersecting ( const Segment other)

Determines if two Segments are intersecting. Two segments are said to be intersecting if they contain a common segment unit. For example, 14 and 36 are intersecting, while 12 and 36 are not.

Parameters
[in]otherThe Segment object with which the comparison is being made
Returns
True if intersecting, False otherwise.
int Segment::length ( )

Gets the length of the Segment, which is the number of segment units it represents. For example, the length of the Segment 16 is 6.

Returns
The length
bool Segment::operator== ( const Segment other)

Checks if two segment objects are identical, which is if their start and end segments are identical.

Parameters
[in]otherThe Segment object with which the comparison is being made
Returns
True if identical, False otherwise

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