/***************************************************************************
 *   Copyright (C) 2004 by Hans Oischinger                                 *
 *   hans.oischinger@kdemail.net                                           *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   51 Franklin Steet, Fifth Floor, Boston, MA 02110-1301, USA.             *
 ***************************************************************************/
#include "timeattribute.h"

// Visitors
#include "visitors/avisitor.h"

// KDE
#include <kdebug.h>

TimeAttribute::TimeAttribute()
    : Attribute(ATTR_TIME),
    m_value(0.0)
{}

TimeAttribute::TimeAttribute( double time )
    : Attribute(ATTR_TIME),
    m_value(time)
{
  setValid();
}

TimeAttribute::TimeAttribute( const TimeAttribute &other )
  : Attribute(ATTR_TIME),
    m_value(0.0)
{
  (*this) = other;
}

TimeAttribute::~TimeAttribute()
{}

TimeAttribute & TimeAttribute::operator =( const TimeAttribute &other )
{
  Attribute::operator=(other);
  m_value = other.value();
  return *this;
}

bool TimeAttribute::operator ==( const TimeAttribute &other )
{
  if (m_value == other.value())
    return true;
  else
    return false;
}

bool TimeAttribute::operator !=( const TimeAttribute &other )
{
  return !(*this==other);
}

Attribute * TimeAttribute::clone( )
{
  // kdDebug() << "TimeAttribute::clone " << value() << endl;
  TimeAttribute* retElem = new TimeAttribute();
  *retElem = *this;
  return ( retElem );
}

void TimeAttribute::setValue( double time )
{
  m_value = time;
  setValid();
}

void TimeAttribute::accept( AVisitor &a )
{
  a.visit(*this);
}




