[seam-commits] Seam SVN: r11852 - modules/remoting/trunk/src/main/resources/org/jboss/seam/remoting.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Thu Dec 17 06:05:52 EST 2009
Author: shane.bryzak at jboss.com
Date: 2009-12-17 06:05:52 -0500 (Thu, 17 Dec 2009)
New Revision: 11852
Modified:
modules/remoting/trunk/src/main/resources/org/jboss/seam/remoting/remote.js
Log:
oops, some other date related stuff
Modified: modules/remoting/trunk/src/main/resources/org/jboss/seam/remoting/remote.js
===================================================================
--- modules/remoting/trunk/src/main/resources/org/jboss/seam/remoting/remote.js 2009-12-17 10:59:32 UTC (rev 11851)
+++ modules/remoting/trunk/src/main/resources/org/jboss/seam/remoting/remote.js 2009-12-17 11:05:52 UTC (rev 11852)
@@ -129,12 +129,19 @@
Seam.Exception = function(msg) {
this.message = msg;
-
Seam.Exception.prototype.getMessage = function() {
return this.message;
}
}
+Seam.equals = function(v1, v2) {
+ if (v1 == v2) return true;
+ if (v1 instanceof Date && v2 instanceof Date &&
+ v1.getTime() == v2.getTime()) return true;
+
+ return false;
+}
+
Seam.Map = function() {
this.elements = new Array();
@@ -165,29 +172,16 @@
Seam.Map.prototype.get = function(key) {
for (var i=0; i<this.elements.length; i++) {
var e = this.elements[i];
- if (e.key == key)
- return e.value;
- else if (key instanceof Date && e.key instanceof Date && key.getTime() == e.key.getTime())
- return e.value;
+ if (Seam.equals(e.key, key)) return e.value;
}
return null;
}
Seam.Map.prototype.put = function(key, value) {
- if (key instanceof Date) {
- for (var i=0; i<this.elements.length; i++) {
- if (this.elements[i] instanceof Date && this.elements[i].getTime() == key.getTime()) {
- this.elements[i].value = value;
- return;
- }
- }
- }
- else {
- for (var i=0; i<this.elements.length; i++) {
- if (this.elements[i].key == key) {
- this.elements[i].value = value;
- return;
- }
+ for (var i=0; i<this.elements.length; i++) {
+ if (Seam.equals(this.elements[i].key, key)) {
+ this.elements[i].value = value;
+ return;
}
}
this.elements.push({key:key,value:value});
@@ -195,14 +189,16 @@
Seam.Map.prototype.remove = function(key) {
for (var i=0; i<this.elements.length; i++) {
- if (this.elements[i].key == key)
+ if (Seam.equals(this.elements[i].key, key)) {
this.elements.splice(i, 1);
+ break;
+ }
}
}
Seam.Map.prototype.contains = function(key) {
for (var i=0; i<this.elements.length; i++) {
- if (this.elements[i].key == key) return true;
+ if (Seam.equals(this.elements[i].key, key)) return true;
}
return false;
}
More information about the seam-commits
mailing list