from gettext import gettext as _

class Side:
    """
    Set of two index from the same axis
    """

    def __init__( self , min = 0 , max = 0 ):
        if not isinstance( min , int ) or not isinstance( max , int ):
            raise TypeeError( _( 'min and max should be int' ) )

    def scale( self , factor ):
        """
        Update coordinate to adapt from compression
        """
        self.min = int( self.min * factor )
        self.max = int( self.max * factor )
    def size( self ):
        """
        Compute size of the side
        """
        return self.max - self.min
    def __str__( self ):
        return '\
side: [\
\n    min: ' + str( self.min ) + '\
\n    max: ' + str( self.max ) + '\
\n]\
        '