﻿function TList()
{
	//private
		var self = this;
		var elementList = new Array();

	//public
		this.count = function()
		{
			return elementList.length;
		}
		
		this.clear = function()
		{
			while (elementList.length > 0)
			{
				elementList.pop();
			}	
		}

		this.add = function(value)
		{
			elementList.push(value);
		}

		this.get = function(index)
		{
			return elementList[index];		
		}

		this.findById = function(value)
		{
			var c = 0;
			var result = null;

			while (c <= elementList.length-1 && result === null)
			{
				if (elementList[c].id === value)
				{
					result = elementList[c];	
				}
				
				c++;
			}

			return result;
		}

		this.find = function(value)
		{
			var c = 0;
			var result = null;

			while (c <= elementList.length-1 && result === null)
			{
				if (elementList[c].determineFindValue() === value)
				{
					result = elementList[c];	
				}
				
				c++;
			}

			return result;
		}
}
