Projekt

Obecné

Profil

Stáhnout (1.16 KB) Statistiky
| Větev: | Tag: | Revize:
1 1e2b2c27 Tomáš Šimandl
2
/**
3
* GroupManager caters to group.
4
*/
5
function GroupManager() {
6
	var groupList = {};
7
	var size = 0;
8
9
	/**
10
	 * Low-level access to the hash table.
11
	 */
12
	this.getAll = function() {
13
		return groupList;
14
	};
15
16
	/**
17
	 * Adds group to list of groups.
18
	 *
19
	 * @param idGroup group ID
20
	 * @param group group which will be added
21
	 */
22
	this.addGroupToList = function(idGroup, group) {
23
		groupList[idGroup] = group;
24
		size++;
25
	};
26
27
	/**
28
	 * Removes group from list of groups.
29
	 *
30
	 * @param idGroup group ID
31
	 */
32
	this.removeGroupFromList = function(idGroup) {
33
		delete groupList[idGroup];
34
		size--;
35
	};
36
37
	/**
38
	 * Finds out if the group with given id is in list of existing group.
39
	 *
40
	 * @param idGroup group ID
41
	 * @returns {boolean} true if group is in list
42
	 */
43
	this.existGroup = function(idGroup) {
44
		if (groupList[idGroup] === null || groupList[idGroup] === undefined) {
45
			return false;
46
		}
47
48
		return true;
49
	};
50
51
	/**
52
	 * Gets group with given id.
53
	 *
54
	 * @param idGroup group ID
55
	 * @returns {*} group from list
56
	 */
57
	this.getGroup = function(idGroup) {
58
		return groupList[idGroup];
59
	};
60
	
61
	/**
62
	* Get count of group in group list.
63
	*/
64
	this.size = function() {
65
		return this.size;
66
	};
67
}