What if we move FastStringMap into http://code.google.com/p/google-web-toolkit/source/browse/#svn/trunk/user/src/com/google/gwt/user/client/impl ? On Wed, Oct 15, 2008 at 11:00 AM, Emily Crutcher <[EMAIL PROTECTED]> wrote:
> I do not think we want to make FastStringMap public where it is, though > this might be another good reason to accelerate creating a jscollection > package in GWT. > > > > > On Wed, Oct 15, 2008 at 10:07 AM, Amit Manjhi <[EMAIL PROTECTED]>wrote: > >> Hi John, >> >> Please review the attached patch which fixes >> http://code.google.com/p/google-web-toolkit/issues/detail?id=2862 As per >> Scott's suggestion in the comments, I changed the implementation to use >> FastStringMap. Since FastStringMap is in a different package, I had to make >> the class public and make some of the private fields protected. The change >> passes all the i18n tests. Finally, modulo everything looks good, should >> this go in 1_5_3? >> >> Regards, >> Amit >> >> Index: user/src/com/google/gwt/i18n/client/impl/ConstantMap.java >> =================================================================== >> --- user/src/com/google/gwt/i18n/client/impl/ConstantMap.java (revision >> 3731) >> +++ user/src/com/google/gwt/i18n/client/impl/ConstantMap.java (working >> copy) >> @@ -15,9 +15,10 @@ >> */ >> package com.google.gwt.i18n.client.impl; >> >> +import com.google.gwt.user.client.ui.FastStringMap; >> + >> import java.util.ArrayList; >> import java.util.Collection; >> -import java.util.HashMap; >> import java.util.Iterator; >> import java.util.Map; >> import java.util.Set; >> @@ -30,26 +31,15 @@ >> * specific, no elements are every removed from them and all elements are >> added >> * before the first user operation. >> */ >> -public class ConstantMap extends HashMap<String, String> { >> +public class ConstantMap extends FastStringMap<String> { >> >> - private static class DummyMapEntry implements Map.Entry<String, String> >> { >> - private final String key; >> + private static class DummyMapEntry extends >> FastStringMap.ImplMapEntry<String> { >> >> - private final String value; >> - >> DummyMapEntry(String key, String value) { >> - this.key = key; >> - this.value = value; >> + super(key, value); >> } >> >> - public String getKey() { >> - return key; >> - } >> - >> - public String getValue() { >> - return value; >> - } >> - >> + @Override >> public String setValue(String arg0) { >> throw new UnsupportedOperationException(); >> } >> Index: user/src/com/google/gwt/user/client/ui/FastStringMap.java >> =================================================================== >> --- user/src/com/google/gwt/user/client/ui/FastStringMap.java (revision >> 3731) >> +++ user/src/com/google/gwt/user/client/ui/FastStringMap.java (working >> copy) >> @@ -31,16 +31,23 @@ >> * Special-case Map implementation which imposes limits on the types of >> keys >> * that can be used in return for much faster speed. In specific, only >> strings >> * that could be added to a JavaScript object as keys are valid. >> + * >> + * @param <T> the type of values. >> */ >> +public class FastStringMap<T> extends AbstractMap<String, T> { >> >> -class FastStringMap<T> extends AbstractMap<String, T> { >> - private static class ImplMapEntry<T> implements Map.Entry<String, T> { >> + /** >> + * Internal map entry. >> + * >> + * @param <T> The type of values. >> + */ >> + protected static class ImplMapEntry<T> implements Map.Entry<String, T> >> { >> >> private String key; >> >> private T value; >> >> - ImplMapEntry(String key, T value) { >> + protected ImplMapEntry(String key, T value) { >> this.key = key; >> this.value = value; >> } >> @@ -99,7 +106,7 @@ >> /* >> * Accesses need to be prefixed with ':' to prevent conflict with >> built-in >> * JavaScript properties. >> - */ >> + */ >> private JavaScriptObject map; >> >> public FastStringMap() { >> >> >> >> >> > > > -- > "There are only 10 types of people in the world: Those who understand > binary, and those who don't" > --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---
