Customer CustomerList::operator[](int index) const
{
	Node<Customer> * traversePtr;

	if(isEmpty())
	{
		throw EmptyList();
	}

	if (index > _listLimit)
	{
		throw OutOfRange();
	}


	// NEED TO MAKE SURE 2 ACCOUNT NUMBERS CANNOT BE THE SAME //
	traversePtr = _head;
	int i = 0;
	while (i < _listLimit && traversePtr !=NULL &&
		   i != index)
	{
		traversePtr = traversePtr->GetNext();

		i++;
	}

	if (traversePtr == NULL)
	{
		// throw exception class if not found.
		traversePtr = NULL;
		throw NotFound();
	}

	return traversePtr->GetData();
}
Beispiel #2
0
void llist::deleteIth(int I, el_t& Old)
{
          // case(exception)
          // ---------------
          if(I < 1 || I > Count)
            throw OutOfRange();

          // case(I is the front)
          // --------------------
          else if(I == 1)
            deleteFront(Old);

          // case(I is the rear)
          // -------------------
          else if(I == Count)
            deleteRear(Old);

          // case(I is any node between front and rear)
          // ------------------------------------------
          else
          {
            Node *temp = Front;
            Node *del;

            for(int j = 1; j < I - 1; j++)
              temp = temp->Next;

            del = temp->Next;
            Old = del->Elem;
            temp->Next = del->Next;
            delete del;
            Count--;
          }
}
OptionBinds::Item & OptionBinds::at(const std::string & id)
{
    auto item = items.find(id);
    if (item == items.end())
        throw OutOfRange(id);
    return item->second;
}
Beispiel #4
0
void llist::addbeforeIth(int I, el_t New)
{
          // case(exception)
          // ---------------
          if(I < 1 || I > Count + 1)
            throw OutOfRange();

          // case(I is the front)
          // --------------------
          else if(I == 1)
            addFront(New);

          // case(I is the rear)
          // -------------------
          else if(I == Count + 1)
            addRear(New);

          // case(I will be squished between two nodes)
          // ------------------------------------------
          else
          {
            Node *temp_P = Front;
            Node *temp_N;
            for(int j = 1; j < I - 1; j++)
              temp_P = temp_P->Next;

            temp_N = temp_P->Next;
            temp_P->Next = new Node;
            temp_P = temp_P->Next;
            temp_P->Elem = New;
            temp_P->Next = temp_N;
            Count++;
          }
}
Beispiel #5
0
//-------------------------------------------------------------------------------------------------
const Class& ClassManager::getByIndex(std::size_t index) const
{
    // Make sure that the index is not out of range
    if (index >= m_classes.size())
        CAMP_ERROR(OutOfRange(index, m_classes.size()));

    return *m_classes[index].classPtr;
}
Beispiel #6
0
//-------------------------------------------------------------------------------------------------
TypeInfo Function::argTypeInfo(std::size_t index) const
{
    // Make sure that the index is not out of range
    if (index >= m_argTypeInfo.size())
        CAMP_ERROR(OutOfRange(index, m_argTypeInfo.size()));

    return m_argTypeInfo[index];
}
Beispiel #7
0
//-------------------------------------------------------------------------------------------------
Type Constructor::argType(std::size_t index) const
{
    // Make sure that the index is not out of range
    if (index >= m_argTypes.size())
        CAMP_ERROR(OutOfRange(index, m_argTypes.size()));

    return m_argTypes[index];
}
Beispiel #8
0
//-------------------------------------------------------------------------------------------------
const Function& Class::getOperator(std::size_t index) const
{
    // Make sure that the index is not out of range
    if (index >= m_operators.size())
        CAMP_ERROR(OutOfRange(index, m_operators.size()));

    return *m_operators[index];
}
Beispiel #9
0
//-------------------------------------------------------------------------------------------------
const Constructor& Class::constructor(std::size_t index) const
{
    // Make sure that the index is not out of range
    if (index >= m_constructors.size())
        CAMP_ERROR(OutOfRange(index, m_constructors.size()));

    return *m_constructors[index];
}
Beispiel #10
0
//-------------------------------------------------------------------------------------------------
const Value& Args::operator[](std::size_t index) const
{
    // Make sure that the index is not out of range
    if (index >= m_values.size())
        PONDER_ERROR(OutOfRange(index, m_values.size()));

    return m_values[index];
}
Beispiel #11
0
/*! \throws OutOfRange if \p drive does not specify a valid drive
 *  \throws DiskImageError if disk image \p name could not be loaded
 */
void Drives::LoadDisk(unsigned int drive, const char *name)
{
    if (drive >= cNumDrives)
        throw OutOfRange();

    UnloadDisk(drive);  // In case a disk is already loaded
    disks[drive] = new Disk(name);
}
Beispiel #12
0
const Class& Class::base(std::size_t index) const
{
    // Make sure that the index is not out of range
    if (index >= m_bases.size())
        PONDER_ERROR(OutOfRange(index, m_bases.size()));

    return *m_bases[index].base;
}
Beispiel #13
0
//-------------------------------------------------------------------------------------------------
Enum::Pair Enum::pair(std::size_t index) const
{
    // Make sure that the index is not out of range
    if (index >= m_enums.size())
        PONDER_ERROR(OutOfRange(index, m_enums.size()));

    auto it = m_enums.at(index);
    return Pair(it->first, it->second);
}
Beispiel #14
0
const char& String::operator[](unsigned pos) const
{
	if(pos > this->size)
	{
		throw OutOfRange();
	}

	return this->array[pos];
}
Beispiel #15
0
//-------------------------------------------------------------------------------------------------
const Property& Class::property(std::size_t index, bool ownOnly /*= false*/) const
{
    const PropertyTable& table = ownOnly?m_own_properties:m_properties;

    // Make sure that the index is not out of range
    if (index >= table.size())
        CAMP_ERROR(OutOfRange(index, table.size()));

    return *table[index];
}
Beispiel #16
0
//-------------------------------------------------------------------------------------------------
const Function& Class::function(std::size_t index, bool ownOnly /*= false*/) const
{
    const FunctionTable& table = ownOnly?m_own_functions:m_functions;

    // Make sure that the index is not out of range
    if (index >= table.size())
        CAMP_ERROR(OutOfRange(index, table.size()));

    return *table[index];
}
Beispiel #17
0
		const iterator operator++ (int){
			iterator tmp = *this;
			if (this->position < master->size) {
				this->position++;
				return tmp;
			}
			else {
				throw OutOfRange();
			}
		}
Point3D ShapeParabolicRectangle::GetPoint3D( double u, double v ) const
{
	if ( OutOfRange( u, v ) ) gf::SevereError( "Function Poligon::GetPoint3D called with invalid parameters" );

	double x = ( u - 0.5 )* widthX.getValue();
	double z = ( v - 0.5 )* widthZ.getValue();
	double y = ( x * x + z * z)/( 4 * focusLength.getValue() );
	return Point3D (x, y, z);

}
Beispiel #19
0
//-------------------------------------------------------------------------------------------------
const Enum& EnumManager::getByIndex(std::size_t index) const
{
    // Make sure that the index is not out of range
    if (index >= m_enums.size())
        CAMP_ERROR(OutOfRange(index, m_enums.size()));

    EnumTable::const_iterator it = m_enums.begin();
    std::advance(it, index);

    return *it->enumPtr;
}
Beispiel #20
0
const Function& Class::function(std::size_t index) const
{
    // Make sure that the index is not out of range
    if (index >= m_functions.size())
        PONDER_ERROR(OutOfRange(index, m_functions.size()));

    FunctionTable::const_iterator it = m_functions.begin();
    std::advance(it, index);

    return *it->second;
}
Beispiel #21
0
const Property& Class::property(std::size_t index) const
{
    // Make sure that the index is not out of range
    if (index >= m_properties.size())
        PONDER_ERROR(OutOfRange(index, m_properties.size()));

    PropertyTable::const_iterator it = m_properties.begin();
    std::advance(it, index);

    return *it->second;
}
Beispiel #22
0
const Value& TagHolder::tagId(std::size_t index) const
{
    // Make sure that the index is not out of range
    if (index >= m_tags.size())
        PONDER_ERROR(OutOfRange(index, m_tags.size()));

    TagsTable::const_iterator it = m_tags.begin();
    std::advance(it, index);

    return it->first;
}
Beispiel #23
0
void Drives::UnloadDisk(unsigned int drive)
{
    if (drive >= cNumDrives)
        throw OutOfRange();

    if (disks[drive] != NULL)
    {
        delete disks[drive];
        disks[drive] = NULL;
    }
}
Beispiel #24
0
//-------------------------------------------------------------------------------------------------
const Class& ClassManager::getByIndex(std::size_t index) const
{
    // Make sure that the index is not out of range
    if (index >= m_classes.size())
        CAMP_ERROR(OutOfRange(index, m_classes.size()));

    ClassTable::const_iterator it = m_classes.begin();
    std::advance(it, index);

    return *it->classPtr;
}
Beispiel #25
0
void ActiveBehaviour::TryUpdateFrame(const glm::vec3 &location)
{
	if (length(obj->bones[0]->translation - location) < range)
	{
		UpdateFrame();
		wasInRange = true;
	}
	else if (wasInRange)
	{
		OutOfRange();
		wasInRange = false;
	}
}
Beispiel #26
0
double FiveAndFive::fiveAndFive( int number ) throw (InvalidArgument, OutOfRange) {
    if ( (number % 5) != 0 ) {
        throw InvalidArgument( number );
    }

    const int beginOfRange = 5;
    const int endOfRange = 400000;
    if ( (number < beginOfRange) || (endOfRange < number) ) {
        throw OutOfRange( number, beginOfRange, endOfRange );
    }

    double result = (double) number * (double) number;
    return result;
}
Beispiel #27
0
/*!
  \brief set widget value
*/
int PTank::setValue(double newValue)
{
    int retCode=0;
    if(newValue<dMin || newValue>dMax)
    {
        emit OutOfRange(newValue);
        retCode=-1;
    }
    else
    {
        if(dValue>dThreshold && newValue<=dThreshold)
            emit ThresholdEvent(newValue);
        dValue=newValue;
        update();
    }
    return (retCode);
}
Beispiel #28
0
/*!
  \brief set maximum value
*/
int PTank::setMaxValue(double newMaxValue)
{
    int retCode=0;
    if(newMaxValue<dMin)
    {
        retCode=-1;
    }
    else
    {
        dMax=newMaxValue;
        if(dValue>dMax)
            emit OutOfRange(dValue);
        if(dThreshold>dMax)
            dThreshold=dMax;
        update();
    }
    return retCode;
}
Beispiel #29
0
    static SIZE_TYPE Subseq
    (const SrcCont& src,
     TCoding coding,
     TSeqPos pos,
     TSeqPos length,
     DstCont& dst)
    {
        _ASSERT(!OutOfRange(pos, src, coding));

        if ( src.empty()  ||  (length == 0) ) {
            return 0;
        }
        
        AdjustLength(src, coding, pos, length);
        ResizeDst(dst, coding, length);
        
        return Subseq(&*src.begin(), coding, pos, length, &*dst.begin());
    }
Beispiel #30
0
 static SIZE_TYPE Convert
 (const SrcCont& src,
  TCoding src_coding,
  TSeqPos pos,
  TSeqPos length,
  DstCont& dst, 
  TCoding dst_coding)
 {
     _ASSERT(!OutOfRange(pos, src, src_coding));
     
     if ( src.empty()  ||  (length == 0) ) {
         return 0;
     }
     
     AdjustLength(src, src_coding, pos, length);
     ResizeDst(dst, dst_coding, length);
     
     return Convert(&*src.begin(), src_coding, pos, length,
         &*dst.begin(), dst_coding);
 }