Handle all ops consistently for StopSegments.

If there is a reason why not all operators were implemented,
I haven't seen one. Blame the Java experience within me.
This commit is contained in:
Jason Felds
2011-01-14 10:16:26 -05:00
parent 5e32606caa
commit 602cfa6910
+15 -1
View File
@@ -54,10 +54,24 @@ struct StopSegment
return true; return true;
} }
bool operator!=( const StopSegment &other ) const { return !operator==(other); } bool operator!=( const StopSegment &other ) const { return !operator==(other); }
// Delays need to come before stops to not render them pointless.
bool operator<( const StopSegment &other ) const bool operator<( const StopSegment &other ) const
{ {
return ( m_iStartRow < other.m_iStartRow ) || return ( m_iStartRow < other.m_iStartRow ) ||
( m_iStartRow == other.m_iStartRow && m_bDelay ); ( m_iStartRow == other.m_iStartRow && m_bDelay && !other.m_bDelay );
}
bool operator<=( const StopSegment &other ) const
{
return ( operator<(other) || operator==(other) );
}
bool operator>( const StopSegment &other ) const
{
return ( m_iStartRow > other.m_iStartRow ) ||
( m_iStartRow == other.m_iStartRow && !m_bDelay && other.m_bDelay );
}
bool operator>=( const StopSegment &other ) const
{
return ( operator>(other) || operator==(other) );
} }
}; };