/**
 * An element in a line of music
 *
 * @author  Prof. David Bernstein, James Madison University
 * @version 1.0
 */
public abstract class AbstractLineElement
{
    private int       durationInMillis, wholeNoteInMillis=1500;
    private String    value;
    

    /**
     * Get the duration of this element in milliseconds
     * (at the normal tempo)
     *
     * @return   The duration in milliseconds
     */
    public int getDurationInMillis()
    {
	return durationInMillis;
    }



    /**
     * Get a String representation of the value of this
     *
     * @return   The value
     */
    public String getValue()
    {
       return value;       
    }


    /**
     * Get the duration of this element
     *
     * @param beats  The beats in this element (whole=1, half=2, quarter=4)
     * @param dotted Whether this element is dotted
     */
    protected void setDuration(int beats, boolean dotted)
    {
        durationInMillis = wholeNoteInMillis / beats;
        if (dotted) durationInMillis *= 1.5;
    }
    

    /**
     * Set the String representation of this element
     *
     * @param value  The value
     */
    protected void setValue(String value)
    {
       this.value = value;       
    }
    
    
}
