flymis/WebRoot/dojojs/src/uuid/Uuid.js

(开头部分) 14KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

/*
	Copyright (c) 2004-2006, The Dojo Foundation
	All Rights Reserved.

	Licensed under the Academic Free License version 2.1 or above OR the
	modified BSD license. For more information on Dojo licensing, see:

		http://dojotoolkit.org/community/licensing.shtml
*/

dojo.provide("dojo.uuid.Uuid");
dojo.require("dojo.lang.common");
dojo.require("dojo.lang.assert");

dojo.uuid.Uuid = function(/* string || generator */ input) {
	// summary: 
	//   This is the constructor for the Uuid class.  The Uuid class offers 
	//   methods for inspecting existing UUIDs.
	
	// examples:
	//   var uuid;
	//   uuid = new dojo.uuid.Uuid("3b12f1df-5232-4804-897e-917bf397618a");
	//   uuid = new dojo.uuid.Uuid(); // "00000000-0000-0000-0000-000000000000"
	//   uuid = new dojo.uuid.Uuid(dojo.uuid.RandomGenerator);
	//   uuid = new dojo.uuid.Uuid(dojo.uuid.TimeBasedGenerator);
	//   dojo.uuid.Uuid.setGenerator(dojo.uuid.RandomGenerator);
	//   uuid = new dojo.uuid.Uuid();
	//   dojo.lang.assert(!uuid.isEqual(dojo.uuid.Uuid.NIL_UUID));
	this._uuidString = dojo.uuid.Uuid.NIL_UUID;
	if (input) {
		if (dojo.lang.isString(input)) {
			// input: string? A 36-character string that conforms to the UUID spec.
			this._uuidString = input.toLowerCase();
			dojo.lang.assert(this.isValid());
		} else {
			if (dojo.lang.isObject(input) && input.generate) {
				// input: generator A UUID generator, such as dojo.uuid.TimeBasedGenerator.
				var generator = input;
				this._uuidString = generator.generate();
				dojo.lang.assert(this.isValid());
			} else {
				// we got passed something other than a string
				dojo.lang.assert(false, "The dojo.uuid.Uuid() constructor must be initializated with a UUID string.");
			}
		}
	} else {
		var ourGenerator = dojo.uuid.Uuid.getGenerator();
		if (ourGenerator) {
			this._uuidString = ourGenerator.generate();
			dojo.lang.assert(this.isValid());
		}
	}
};

// -------------------------------------------------------------------
// Public constants
// -------------------------------------------------------------------
dojo.uuid.Uuid.NIL_UUID = "00000000-0000-0000-0000-000000000000";
dojo.uuid.Uuid.Version = {
	UNKNOWN: 0,
后面还有 319 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。