contributions/jsPrototyping/js/companies101.js
/**
	 * Department
	 *	A composition of departments and employees
	 *
	 * @this{Department}
	 */
Department
A composition of departments and employees

@this{Department}
Department A composition of departments and employees @this { Department }
function Department(name) {
		Nameable.call(this, name);
		var _subDepartments	= [];
		var _employees		= [];
		this.getSubDepartments = function() {
			return _subDepartments.clone();
		};
		this.addSubDepartment = function(dep) {
			if (!(dep instanceof Department)) {
				throw "The first argument must be a Department!";
			}
			_subDepartments.push(dep);
		};
		this.getEmployees = function() {
			return _employees.clone();
		};
		this.addEmployee = function(emp) {
			if (!(emp instanceof Employee)) {
				throw "The first argument must be a Employee!";
			}
			_employees.push(emp);
		};
	}
function Department ( name ) { Nameable . call ( this , name ) ; var _subDepartments = [ ] ; var _employees = [ ] ; this . getSubDepartments = function ( ) { return _subDepartments . clone ( ) ; } ; this . addSubDepartment = function ( dep ) { if ( ! ( dep instanceof Department ) ) { throw "The first argument must be a Department!" ; } _subDepartments . push ( dep ) ; } ; this . getEmployees = function ( ) { return _employees . clone ( ) ; } ; this . addEmployee = function ( emp ) { if ( ! ( emp instanceof Employee ) ) { throw "The first argument must be a Employee!" ; } _employees . push ( emp ) ; } ; }
Department
      A composition of departments and employees
Department A composition of departments and employees
// Private fields // Public methods, which use private fields