一个即时消息系统的源码(J2ME编程部分)。

源代码在线查看: prefixmap.java

软件大小: 27 K
上传用户: zln12345
关键词: J2ME 即时消息
下载地址: 免注册下载 普通下载 VIP

相关代码

				package org.kxml;								import java.util.*;								/** Like Attribute, this class is immutable for similar reasons */								public class PrefixMap {								    Hashtable prefixMap;				    Hashtable namespaceMap;								    public PrefixMap () {					prefixMap = new Hashtable ();					namespaceMap = new Hashtable ();				    }												    public PrefixMap (PrefixMap base, String prefix, String namespace) {       									prefixMap = clone (base.prefixMap);					namespaceMap = clone (base.prefixMap);										if (namespace == null) namespace = "";					String oldNS = (String) prefixMap.get (prefix);					if (oldNS == null) oldNS = "";										if (!namespace.equals (oldNS)) {					    					    if (prefix.equals (namespaceMap.get (oldNS))) 						namespaceMap.remove (oldNS);					    					    prefixMap.put (prefix, namespace);					    namespaceMap.put (namespace, prefix);					}				    } 												    private static Hashtable clone (Hashtable original) {									Hashtable copy = new Hashtable (original.size () + 1);					for (Enumeration e = original.keys (); e.hasMoreElements ();) {					    Object key = e.nextElement ();					    copy.put (key, original.get (key));					}					return copy;				    }												    public String getNamespace (String prefix) {					String namespace = (String) prefixMap.get (prefix);					return namespace == null ? Xml.NO_NAMESPACE : namespace;				    }												    public String getPrefix (String namespace) {					return (String) namespaceMap.get 					    (namespace == null ? "" : namespace);				    }												    public Enumeration prefixEnumeration () {					return prefixMap.keys ();				    }				}											

相关资源