﻿
function Vector()
{
	this.item = {};
	this.Add = function( key, value )
	{
		this.item[ key ] = value;
	}
	this.Delete = function( key )
	{
		delete this.item[ key ];
	}
	this.GetItem=function(key)
	{
	   return this.item[key];
	}
	this.Length = function()
	{
		var i = 0;
		for( e in this.item )
		{
			i++
		}
		return i;
	};
	this.LastNodeKey = function()
	{
		var key;
		for( e in this.item )
		{
			key = e;
		}
		return key;
	}
	this.MaxNodeID = function()
	{
		var id = 0;
		for( e in this.item )
		{
			if( id < parseInt( e ) )
			{
				id = parseInt( e );
			}
		}
		return id;
	}
	
	this.Contains = function( key )
	{
		for( e in this.item )
		{
			if( key == e )
			{
				return true;
			}
		}
		return false;
	}
	this.GetFiltKeyValue = function(filt)
	{
		var values=[];
		for( e in this.item )
		{
		    if(e.indexOf(filt)>-1)
		    {
		      values[values.length]=this.item[e];
		    }
			
		}
		return values;
	}
	this.getarray=function()
	{
	  var values=[];
	  for(e in this.item)
	  {
	     values[values.length]=this.item[e];
	  }
	  return values;
	}
}