﻿//obiekt Dictionary
function Dictionary() {
	//tablica z zawartoscia
	this.Items = new Array();
	//zwraca tablice z kluczami slownika
	this.Keys = function () {
		var tmpArr = new Array();
	}
	//zwraca wartosc slownika dla konkretnego klucza
	this.Read = function (key) {
		//search array for key
		for (var i=0; i<this.Items.length; i++) {
			if (this.Items[i][0]===key) { return this.Items[i][1];}
		}
		return null;
	}
	//zapisuje wartosc dla konkretnego klucza / tworzy nowy klucz gdy nie istnieje
	this.Write  = function(key, value) {
		if (this.isExists(key)) {
			this.Items[key][0]=key;
			this.Items[key][1]=value;
		}
		else {
			this.Items[this.Items.length] = new Array(key, value);
		}
	}
	
	//sprawdza czy klucz istnieje
	this.isExists = function (key){
		for (var i=0;i<this.Items.length; i++){
			if (this.Items[i][0]===key) {return true;}
		}
		return false;
	}

}
