"""

File: time_conversion.py

Purpose: To define a set of time-based conversion methods including:
   whole time --> actual time
   actual time --> whole time

"""
from misc.ordered_map import OrderedMap
from structure.tempo import Tempo
from structure.time_signature import TimeSignature
from fractions import Fraction
from timemodel.beat_position import BeatPosition
from timemodel.position import Position
from timemodel.duration import Duration


class Element(object):
    
    def __init__(self, ts_or_tempo, position):
        self.__element = ts_or_tempo
        self.__is_tempo = isinstance(ts_or_tempo, Tempo)
        if not self.__is_tempo and not isinstance(ts_or_tempo, TimeSignature):
            raise Exception('Expecting Tempo or TimeSignature, not {0}'.format(type(ts_or_tempo)))
        
        self.__position = position