[minijoe] r84 committed - - Added elements() method to return an Enumeration of elements in this...

0 views
Skip to first unread message

min...@googlecode.com

unread,
Oct 6, 2010, 8:53:16 AM10/6/10
to min...@googlegroups.com
Revision: 84
Author: orientalsensation
Date: Wed Oct 6 05:52:47 2010
Log: - Added elements() method to return an Enumeration of elements in this
Object
- Added clear() method to clear all properties in this Object
http://code.google.com/p/minijoe/source/detail?r=84

Modified:
/trunk/src/com/google/minijoe/sys/JsObject.java

=======================================
--- /trunk/src/com/google/minijoe/sys/JsObject.java Fri Oct 1 16:49:08 2010
+++ /trunk/src/com/google/minijoe/sys/JsObject.java Wed Oct 6 05:52:47 2010
@@ -432,9 +432,23 @@
* prototype or scope chain.
*/
public Enumeration keys(){
- return data == null ? new Hashtable().keys() : data.keys();
- }
-
+ if(data == null) {
+ data = new Hashtable();
+ }
+ return data.keys();
+ }
+
+ /**
+ * Returns elements enumeration for this object only, not including the
+ * prototype or scope chain.
+ */
+ public Enumeration elements(){
+ if(data == null) {
+ data = new Hashtable();
+ }
+ return data.elements();
+ }
+
/**
* Returns a string representation of this.
*/
@@ -464,7 +478,17 @@
}
return true;
}
-
+
+ /**
+ * Clears all properties.
+ */
+ public void clear(){
+ if(data != null) {
+ data.clear();
+ data = null;
+ }
+ }
+
/**
* Execute java member implementation. Parameters for functions start at
* stack[sp+2]. Function and getter results are returned at stack[sp+0].

Reply all
Reply to author
Forward
0 new messages