1 /**
  2  * @namespace The K-Infinity namespace
  3 **/
  4 var $k = {
  5 	/**
  6 	 * Defines a module
  7 	 *
  8 	 * @function
  9 	 * @param {string} [id] Optional module ID
 10 	 * @param {string[]} dependencies IDs of required modules
 11 	 * @param factory Factory that returns the value of the module
 12 	**/
 13 	define: function(id, dependencies, factory) { },
 14 
 15 	/**
 16 	 * Log an object on the current log stream (if available)
 17 	 *
 18 	 * @function
 19 	 * @param object Object to log. Will be converted with toString().
 20 	 * @param [level] Log level. Either a number or a string ("debug", "normal", "warning", "error").
 21 	 * @param {string} channel Optional log channel.
 22 	 * @example $k.log("New instance created");
 23 	 * @example $k.log("The cake is a lie", $k.LOG_WARNING, "Portal");
 24 	**/
 25 	log: function(object, level, channel) { },
 26 
 27 	/**
 28 	 * Log level [DEBUG]
 29 	**/
 30 	LOG_DEBUG: 3,
 31 
 32 	/**
 33 	 *
 34 	 * Log level [ERROR]
 35 	**/
 36 	LOG_ERROR: 30,
 37 
 38 	/**
 39 	 *
 40 	 * Normal log level
 41 	**/
 42 	LOG_NORMAL: 10,
 43 
 44 	/**
 45 	 *
 46 	 * Log level [WARNING]
 47 	**/
 48 	LOG_WARNING: 20,
 49 
 50 	/**
 51 	 *
 52 	 * Map the prototype of instances of the type with the internal name to the prototype object
 53 	 *
 54 	 * @param {string} internalName Internal name of the type of instances to map
 55 	 * @param proto Prototype object
 56 	 * @function
 57 	 * @example function Person() { }
 58 	 * Person.prototype.fullName = function() {
 59 	 *	return this.attributeValue("familyName").toUpperCase() 
 60 	 *		+ ", " + this.attributeValue("firstName");
 61 	 * };
 62 	 * $k.mapInstances("person", Person);
 63 	 * var persons =  $k.Registry.type("person").instances();
 64 	 * for (var p in persons)
 65 	 *	$k.out.print(persons[p].fullName() + "\n");
 66 	**/
 67 	mapInstances: function(internalName, proto) { },
 68 
 69 	/**
 70 	 * Maps a module ID to the ID of a registered script.
 71 	 * Allows to register scripts containing modules under a different ID
 72 	 *
 73 	 * @function
 74 	 * @param {string} moduleName The ID of the module
 75 	 * @param {string} registryID The ID of the registered script
 76 	**/
 77 	mapModule: function(moduleName, registryID) { },
 78 
 79 	/**
 80 	 * Map the prototype of types with the internal name to the prototype object
 81 	 *
 82 	 * @function
 83 	 * @param {string} internalName Internal name of the type to map
 84 	 * @param proto Prototype object
 85 	**/
 86 	mapTypes: function(internalName, proto) { },
 87 
 88 	/**
 89 	 * Loads a module
 90 	 *
 91 	 * @function
 92 	 * @param {string} moduleName The ID of the module
 93 	 * @returns The model value
 94 	 * @throws {$k.exception.ModuleError} If the module was not found or defined more than once
 95 	**/
 96 	module: function(moduleName) { },
 97 
 98 	/**
 99 	 * Evaluates the function in a transaction and returns its return value.
100 	 * Does not check if the transaction has been accepted or rejected.
101 	 * Allows to start a transaction within another transaction, the nested transaction will be a part of the outer transaction
102 	 *
103 	 * @function
104 	 * @param {Function} f Function that should be evaluated in a transaction
105 	 * @returns The return value of the function
106 	 * @throws {$k.exception.TransactionError} If a read-only transaction is already active
107 	 * @see $k#.transaction
108 	**/
109 	optimisticTransaction: function(f) { },
110 
111 	/**
112 	 * Returns the document that represents the output stream of some script environments.
113 	 * The kind of object depends on the environment, but is usually an instance of $k.TextDocument.
114 	 *
115 	 * @example $k.out.print("Name: ", this.name());
116 	 * @see $k.TextDocument
117 	**/
118 	out: undefined,
119 
120 	/**
121 	 * Calls a function with required modules. Passes the value of each required module
122 	 *
123 	 * @function
124 	 * @param {string[]} dependencies IDs of required modules
125 	 * @param {function} callback Callback function
126 	 * @returns The return value of the callback function
127 	 * @throws {$k.exception.ModuleError} If a required module was not found, defined more than once, or a cyclic dependency was detected
128 	**/
129 	require: function(dependencies, callback) { },
130 
131 	/**
132 	 * Returns the root type of the semantic network
133 	 *
134 	 * @function
135 	 * @returns {$k.Type}
136 	**/
137 	rootType: function() { },
138 
139 	/**
140 	 * Returns the parent type of all shortcut relation types
141 	 *
142 	 * @function
143 	 * @returns {$k.Type}
144 	**/
145 	shortcutRelationType: function() { },
146 
147 	/**
148 	 * Returns true if symmetric relation properties are enabled
149 	 *
150 	 * @function
151 	 * @returns {boolean}
152 	**/
153 	symmetricRelationProperties: function() { },
154 
155 	/**
156 	 * Returns the parent type of all system relation types
157 	 *
158 	 * @function
159 	 * @returns {$k.Type}
160 	**/
161 	systemRelationType: function() { },
162 
163 	/**
164 	 * Returns the parent type of all attribute types
165 	 *
166 	 * @function
167 	 * @returns {$k.Type}
168 	**/
169 	topAttributeType: function() { },
170 
171 	/**
172 	 * Returns the parent type of all relation types
173 	 *
174 	 * @function
175 	 * @returns {$k.Type}
176 	**/
177 	topRelationType: function() { },
178 
179 	/**
180 	 * Returns all top types except the top attribute and relation types
181 	 *
182 	 * @function
183 	 * @returns {$k.Type[]}
184 	**/
185 	topTypes: function() { },
186 
187 	/**
188 	 * Evaluates the function in a transaction and returns its return value if the transaction has been accepted.
189 	 * If the transaction is rejected due to concurrency conflicts, the optional reject function is performed.
190 	 * This function does not allow to start a transaction within an outer transaction, use optimisticTransaction() instead.
191 	 *
192 	 * @function
193 	 * @param {Function} f Function that should be evaluated in a transaction
194 	 * @param {Function} [rejectFunction] Optional function that is evaluated if the transaction is rejected.
195 	 * @returns The return value of the function. If  the transaction is rejected, the return value of the reject function (if defined) or undefined is returned.
196 	 * @throws {$k.exception.TransactionError} If another transaction is already active
197 	 * @see $k#.optimisticTransaction
198 	**/
199 	transaction: function(f, rejectFunction) { },
200 
201 	/**
202 	 * Returns the current user
203 	 *
204 	 * @function
205 	 * @returns {$k.User}
206 	**/
207 	user: function() { },
208 
209 	/**
210 	 * Returns the parent type of user-defined relation type
211 	 *
212 	 * @function
213 	 * @returns {$k.Type}
214 	**/
215 	userRelationType: function() { },
216 
217 	/**
218 	 * Generates a UUID
219 	 *
220 	 * @function
221 	 * @returns {string}
222 	**/
223 	uuid: function() { },
224 
225 	/**
226 	 * Returns the name of the semantic network
227 	 *
228 	 * @function
229 	 * @returns {string}
230 	**/
231 	volume: function() { }
232 };