/*File Name: UnderArea.cpp
  Author: Betti Österholz ; Date: 06.08.2003
  System: C++
  
  This is implementation of the Basisclass of all Vector objects


  Copyright (C) 2004  Betti Österholz

  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, June 1991, 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/


#include "UnderArea.h"
//---------------------------------------------------------------------------


   //Construktors:
UnderArea::UnderArea():Vector(2)
//standart constructor
//makes a blank object for from a to b UnderAreas, it has 2 components
{}

UnderArea::UnderArea(const UnderArea& area):Vector(area)
//copy constructor
//makes a UnderArea vector object with the same values as the given UnderArea
//vector
//pre: the UnderArea vector to copy
{}

unsigned long UnderArea::getTimeNeed() const
//to get a idea how long the object need to evaluate
//post: a number for how much time the object need to evaluate
{
unsigned long abs;
if (((*Component[0].Value)<(*Component[1].Value)))
	{ abs=(unsigned long)(((long)(*Component[1].Value))-((long)(*Component[0].Value))+1);
}else{abs=(unsigned long)(((long)(*Component[0].Value))-((long)(*Component[1].Value))+1);}
//check if a overflow has happend
if (  ((((long)(*Component[0].Value))<0)&&(((long)(*Component[1].Value))>0)&&(((long)(*Component[1].Value))>=(long)abs))
	||((((long)(*Component[0].Value))>0)&&(((long)(*Component[1].Value))<0)&&(((long)(*Component[0].Value))>=(long)abs)))
	{return 1000000;}//so no object gets evaluated for this vector
return abs;
}

UnderArea* UnderArea::copy()
//copy this object(means all, even the objects in it)
//post: a pointer to the copy of this object
{
return (new UnderArea(*this));
}
	
std::string UnderArea::classnameOf() const
//returns the classname of this object as a string
//post: the classname of this object as a string
{return "UnderArea";}





