X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fibex%2Fjs%2FJSString.java;h=a0ca694ebaec795f34c9b2c7ac3b6b058221f75c;hb=f3ad8b6cba43f3c5364dc2cd9f1d050c1f48f167;hp=5dc2334b003e378754e3d14fbb957936d8e097d4;hpb=9ed8d93bbb0b40791a4ce31a9a8d79d24a379eb9;p=org.ibex.js.git diff --git a/src/org/ibex/js/JSString.java b/src/org/ibex/js/JSString.java index 5dc2334..a0ca694 100644 --- a/src/org/ibex/js/JSString.java +++ b/src/org/ibex/js/JSString.java @@ -1,24 +1,29 @@ +// Copyright 2000-2005 the Contributors, as shown in the revision logs. +// Licensed under the Apache Public Source License 2.0 ("the License"). +// You may not use this file except in compliance with the License. + package org.ibex.js; import org.ibex.util.*; +import java.util.*; class JSString extends JSPrimitive { final String s; public JSString(String s) { this.s = s; } public int hashCode() { return s.hashCode(); } - public boolean jsequals(JS o) { + public boolean equals(Object o) { if(o == this) return true; if(o instanceof JSString) { return ((JSString)o).s.equals(s); } else if(o instanceof JSNumber) { - return o.jsequals(this); + return o.equals(this); } else { return false; } } - private final static Hash internHash = new Hash(); + private final static Map internHash = new HashMap(); static synchronized JS intern(String s) { synchronized(internHash) { JS js = (JS)internHash.get(s); @@ -31,5 +36,5 @@ class JSString extends JSPrimitive { protected void finalize() { synchronized(internHash) { internHash.put(s,null); } } } - String coerceToString() { return s; } + public String coerceToString() { return s; } }