/*---------------------------------------------------------------------------*
 *  IntArrayList.c  *
 *                                                                           *
 *  Copyright 2007, 2008 Nuance Communciations, Inc.                               *
 *                                                                           *
 *  Licensed under the Apache License, Version 2.0 (the 'License');          *
 *  you may not use this file except in compliance with the License.         *
 *                                                                           *
 *  You may obtain a copy of the License at                                  *
 *      http://www.apache.org/licenses/LICENSE-2.0                           *
 *                                                                           *
 *  Unless required by applicable law or agreed to in writing, software      *
 *  distributed under the License is distributed on an 'AS IS' BASIS,        *
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * 
 *  See the License for the specific language governing permissions and      *
 *  limitations under the License.                                           *
 *                                                                           *
 *---------------------------------------------------------------------------*/

#include "IntArrayList.h"
#include "IntArrayListImpl.h"
#include "pmemory.h"

ESR_ReturnCode IntArrayListAdd(IntArrayList* self, int element)
{
  if (self == NULL)
    return ESR_INVALID_ARGUMENT;
  return self->add(self, element);
}

ESR_ReturnCode IntArrayListRemove(IntArrayList* self, int element)
{
  if (self == NULL)
    return ESR_INVALID_ARGUMENT;
  return self->remove(self, element);
}

ESR_ReturnCode IntArrayListRemoveAll(IntArrayList* self)
{
  if (self == NULL)
    return ESR_INVALID_ARGUMENT;
  return self->removeAll(self);
}

ESR_ReturnCode IntArrayListContains(IntArrayList* self, int element, ESR_BOOL* exists)
{
  if (self == NULL)
    return ESR_INVALID_ARGUMENT;
  return self->contains(self, element, exists);
}

ESR_ReturnCode IntArrayListGetSize(IntArrayList* self, size_t* size)
{
  if (self == NULL)
    return ESR_INVALID_ARGUMENT;
  return self->getSize(self, size);
}

ESR_ReturnCode IntArrayListGet(IntArrayList* self, size_t index, int* element)
{
  if (self == NULL)
    return ESR_INVALID_ARGUMENT;
  return self->get(self, index, element);
}

ESR_ReturnCode IntArrayListSet(IntArrayList* self, size_t index, int element)
{
  if (self == NULL)
    return ESR_INVALID_ARGUMENT;
  return self->set(self, index, element);
}

ESR_ReturnCode IntArrayListToStaticArray(IntArrayList* self, int** newArray)
{
  if (self == NULL)
    return ESR_INVALID_ARGUMENT;
  return self->toStaticArray(self, newArray);
}

ESR_ReturnCode IntArrayListDestroy(IntArrayList* self)
{
  if (self == NULL)
    return ESR_INVALID_ARGUMENT;
  return self->destroy(self);
}
