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.

Definition at line 13 of file segment.h.

Constructor & Destructor Documentation

◆ Segment()

Segment::Segment ( int  startSegment,
int  endSegment 
)

Constructs the Segment object.

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

Definition at line 14 of file segment.cpp.

Member Function Documentation

◆ getName()

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

Definition at line 75 of file segment.cpp.

◆ getType()

FieldType Segment::getType ( )
virtual

Gets the type under the FieldType enum.

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

Implements Field.

Definition at line 66 of file segment.cpp.

◆ getTypeName()

std::string Segment::getTypeName ( )
virtual

Gets the type name, which is "Segment".

Returns
The string "Segment"

Implements Field.

Definition at line 84 of file segment.cpp.

◆ isIntersecting()

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.

Definition at line 52 of file segment.cpp.

◆ length()

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

Definition at line 40 of file segment.cpp.

◆ operator==()

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

Definition at line 28 of file segment.cpp.


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