/*******************************************************************************
 *  Copyright 2017 Centre for Development of Advanced Computing(C-DAC), Pune
 *  
 *  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.
 *******************************************************************************/
package cdac.medinfo.sdk.hl7282.commoninterface;


import java.util.List;

/**
 * Provides the user with an abstract interface towards collections
 * holding series of objects.
 * @param <T> object - object of the type user specifies at the time of instantiation of this interface
 */
public interface ISingleCollection<T> extends ICollectionIterable<T>
{
	/**
	 * Add object to the collection.
	 * @param objT object of the type user specifies at the time of instantiation of this interface
	 * @return boolean - true if element is added successfully 
	 */
	boolean add(T objT);

	/**
	 * Tests if the specified element is peresent in the collection.
	 * @param objT object of the type user specifies at the time of instantiation of this interface
	 * @return boolean - true if elemnent is present in the collection
	 */
	boolean contains(T objT);

	/**
	 * Returns element at specified index.
	 * @param iIndex the integer indicating the position of the element to be retrieved from the collection
	 * @return object - object of the type user specifies at the time of instantiation of this interface 
	 */
	public T elementAt(int iIndex);

	/**
	 * Returns number of elements in the collection.
	 * @return int - number of elements in the collection
	 */
	int size();

	/**
	 * Adds any collection into this collection.
	 * @param collection object of any class collection 
	 * @return boolean -  true if collection is successfully added 
	 */
	public boolean addAll(List<T> collection);

	/**
	 * Removes the element at the specified index.
	 * @param iIndex - position of the element
	 */
	public void remove(int iIndex);
	
	/**
	 * Removes the specified element.
	 * @param objectToRemove object to remove
	 */
	public void remove(Object objectToRemove);
	
	
	/**
	 * Returns true if this collection contains all of the elements in the specified collection otherwise false.
	 * @param objSingleCollection whose elements will be tested for containment in this ISingleCollection
	 * @return true if this ISingleCollection contains all of the elements in the specified Collection otherwise false
	 */
	public boolean containsAll(ISingleCollection<T> objSingleCollection);
	
}
