📄 groupimpl.java
字号:
/** * This class was generated from a set of XML constraints * by the Enhydra Zeus XML Data Binding Framework. All * source code in this file is constructed specifically * to work with other Zeus-generated classes. If you * modify this file by hand, you run the risk of breaking * this interoperation, as well as introducing errors in * source code compilation. * * * * * * MODIFY THIS FILE AT YOUR OWN RISK * * * * * * * To find out more about the Enhydra Zeus framework, you * can point your browser at <http://zeus.enhydra.org> * where you can download releases, join and discuss Zeus * on user and developer mailing lists, and access source * code. Please report any bugs through that website. */package edu.tsinghua.lumaqq.xml.groups;// Global Implementation Import Statementsimport java.io.*;import java.util.HashMap;import java.util.Iterator;import java.util.Map;import org.xml.sax.EntityResolver;import org.xml.sax.ErrorHandler;import org.xml.sax.InputSource;import org.xml.sax.Locator;import org.xml.sax.SAXException;import org.xml.sax.SAXParseException;import org.xml.sax.XMLReader;import org.xml.sax.ext.LexicalHandler;import org.xml.sax.helpers.DefaultHandler;import org.xml.sax.helpers.XMLReaderFactory;// Local Implementation Import Statementsimport java.util.List;import java.util.LinkedList;public class GroupImpl extends DefaultHandler implements Cloneable, Unmarshallable, LexicalHandler, Group { private List FriendList; private List ClusterList; private String upload; private static boolean zeus_UploadInitialized; private static java.util.Vector zeus_validUpload; private boolean zeus_UploadSet; private String blacklist; private static boolean zeus_BlacklistInitialized; private static java.util.Vector zeus_validBlacklist; private boolean zeus_BlacklistSet; private String name; private boolean zeus_NameSet; private String isCluster; private static boolean zeus_IsClusterInitialized; private static java.util.Vector zeus_validIsCluster; private boolean zeus_IsClusterSet; private String friendly; private static boolean zeus_FriendlyInitialized; private static java.util.Vector zeus_validFriendly; private boolean zeus_FriendlySet; private String visible; private static boolean zeus_VisibleInitialized; private static java.util.Vector zeus_validVisible; private boolean zeus_VisibleSet; /** Any DOCTYPE reference/statements. */ private String docTypeString; /** The encoding for the output document */ private String outputEncoding; /** The current node in unmarshalling */ private Unmarshallable zeus_currentUNode; /** The parent node in unmarshalling */ private Unmarshallable zeus_parentUNode; /** Whether this node has been handled */ private boolean zeus_thisNodeHandled = false; /** Whether a DTD exists for an unmarshal call */ private boolean hasDTD; /** Whether validation is occurring */ private boolean validate; /** The namespace mappings on this element */ private Map namespaceMappings; /** The EntityResolver for SAX parsing to use */ private static EntityResolver entityResolver; /** The ErrorHandler for SAX parsing to use */ private static ErrorHandler errorHandler; private static GroupImpl prototype = null; public static void setPrototype(GroupImpl prototype) { GroupImpl.prototype = prototype; } public static GroupImpl newInstance() { try { return (prototype!=null)?(GroupImpl)prototype.clone(): new GroupImpl(); } catch (CloneNotSupportedException e) { return null; // never } } public GroupImpl() { FriendList = new LinkedList(); ClusterList = new LinkedList(); zeus_UploadInitialized = false; zeus_validUpload = null; zeus_UploadSet = false; zeus_BlacklistInitialized = false; zeus_validBlacklist = null; zeus_BlacklistSet = false; zeus_NameSet = false; zeus_IsClusterInitialized = false; zeus_validIsCluster = null; zeus_IsClusterSet = false; zeus_FriendlyInitialized = false; zeus_validFriendly = null; zeus_FriendlySet = false; zeus_VisibleInitialized = false; zeus_validVisible = null; zeus_VisibleSet = false; docTypeString = ""; hasDTD = false; validate = false; namespaceMappings = new HashMap(); } public List getFriendList() { return FriendList; } public void setFriendList(List FriendList) { this.FriendList = FriendList; } public void addFriend(Friend Friend) { FriendList.add(Friend); } public void removeFriend(Friend Friend) { FriendList.remove(Friend); } public List getClusterList() { return ClusterList; } public void setClusterList(List ClusterList) { this.ClusterList = ClusterList; } public void addCluster(Cluster Cluster) { ClusterList.add(Cluster); } public void removeCluster(Cluster Cluster) { ClusterList.remove(Cluster); } public String getUpload() { if(upload == null) return ""; else return upload; } public void setUpload(String upload) throws IllegalArgumentException { if (!zeus_UploadInitialized) { zeus_validUpload = new java.util.Vector(); zeus_validUpload.addElement("true"); zeus_validUpload.addElement("false"); zeus_UploadInitialized = true; } if (!zeus_validUpload.contains(upload)) { throw new IllegalArgumentException("Illegal value for attribute 'upload'"); } else { this.upload = upload; this.zeus_UploadSet = true; } } public String getBlacklist() { if(blacklist == null) return ""; else return blacklist; } public void setBlacklist(String blacklist) throws IllegalArgumentException { if (!zeus_BlacklistInitialized) { zeus_validBlacklist = new java.util.Vector(); zeus_validBlacklist.addElement("true"); zeus_validBlacklist.addElement("false"); zeus_BlacklistInitialized = true; } if (!zeus_validBlacklist.contains(blacklist)) { throw new IllegalArgumentException("Illegal value for attribute 'blacklist'"); } else { this.blacklist = blacklist; this.zeus_BlacklistSet = true; } } public String getName() { if(name == null) return ""; else return name; } public void setName(String name) { this.name = name; zeus_NameSet = true; } public String getIsCluster() { if(isCluster == null) return ""; else return isCluster; } public void setIsCluster(String isCluster) throws IllegalArgumentException { if (!zeus_IsClusterInitialized) { zeus_validIsCluster = new java.util.Vector(); zeus_validIsCluster.addElement("true"); zeus_validIsCluster.addElement("false"); zeus_IsClusterInitialized = true; } if (!zeus_validIsCluster.contains(isCluster)) { throw new IllegalArgumentException("Illegal value for attribute 'isCluster'"); } else { this.isCluster = isCluster; this.zeus_IsClusterSet = true; } } public String getFriendly() { if(friendly == null) return ""; else return friendly; } public void setFriendly(String friendly) throws IllegalArgumentException { if (!zeus_FriendlyInitialized) { zeus_validFriendly = new java.util.Vector(); zeus_validFriendly.addElement("true"); zeus_validFriendly.addElement("false"); zeus_FriendlyInitialized = true; } if (!zeus_validFriendly.contains(friendly)) { throw new IllegalArgumentException("Illegal value for attribute 'friendly'"); } else { this.friendly = friendly; this.zeus_FriendlySet = true; } } public String getVisible() { if(visible == null) return ""; else return visible; } public void setVisible(String visible) throws IllegalArgumentException { if (!zeus_VisibleInitialized) { zeus_validVisible = new java.util.Vector(); zeus_validVisible.addElement("true"); zeus_validVisible.addElement("false"); zeus_VisibleInitialized = true; } if (!zeus_validVisible.contains(visible)) { throw new IllegalArgumentException("Illegal value for attribute 'visible'"); } else { this.visible = visible; this.zeus_VisibleSet = true; } } public void setDocType(String name, String publicID, String systemID) { try { startDTD(name, publicID, systemID); } catch (SAXException neverHappens) { } } public void setOutputEncoding(String outputEncoding) { this.outputEncoding = outputEncoding; } public void marshal(File file) throws IOException { // Delegate to the marshal(Writer) method if (outputEncoding != null) { marshal(new OutputStreamWriter(new FileOutputStream(file), outputEncoding)); } else { marshal(new OutputStreamWriter(new FileOutputStream(file), "utf-8")); } } public void marshal(OutputStream outputStream) throws IOException { // Delegate to the marshal(Writer) method if (outputEncoding != null) { marshal(new OutputStreamWriter(outputStream, outputEncoding)); } else { marshal(new OutputStreamWriter(outputStream, "utf-8")); } } public void marshal(Writer writer) throws IOException { // Write out the XML declaration writer.write("<?xml version=\"1.0\" "); if (outputEncoding != null) { writer.write("encoding=\""); writer.write(outputEncoding); writer.write("\"?>\n\n"); } else { writer.write("encoding=\"UTF-8\"?>\n\n"); } // Handle DOCTYPE declaration writer.write(docTypeString); writer.write("\n"); // Now start the recursive writing writeXMLRepresentation(writer, ""); // Close up writer.flush(); writer.close(); } protected void writeXMLRepresentation(Writer writer, String indent) throws IOException { writer.write(indent); writer.write("<Group"); // Handle namespace mappings (if needed) for (Iterator i = namespaceMappings.keySet().iterator(); i.hasNext(); ) { String prefix = (String)i.next(); String uri = (String)namespaceMappings.get(prefix); writer.write(" xmlns"); if (!prefix.trim().equals("")) { writer.write(":"); writer.write(prefix); } writer.write("=\""); writer.write(uri); writer.write("\"\n "); } // Handle attributes (if needed) if (zeus_UploadSet) { writer.write(" upload=\""); writer.write(escapeAttributeValue(upload)); writer.write("\""); } if (zeus_BlacklistSet) { writer.write(" blacklist=\""); writer.write(escapeAttributeValue(blacklist)); writer.write("\""); } if (zeus_NameSet) { writer.write(" name=\""); writer.write(escapeAttributeValue(name)); writer.write("\""); } if (zeus_IsClusterSet) { writer.write(" isCluster=\""); writer.write(escapeAttributeValue(isCluster)); writer.write("\""); } if (zeus_FriendlySet) { writer.write(" friendly=\""); writer.write(escapeAttributeValue(friendly)); writer.write("\""); } if (zeus_VisibleSet) { writer.write(" visible=\""); writer.write(escapeAttributeValue(visible)); writer.write("\""); } writer.write(">"); writer.write("\n"); // Handle child elements for (Iterator i=FriendList.iterator(); i.hasNext(); ) { FriendImpl friend = (FriendImpl)i.next(); friend.writeXMLRepresentation(writer, new StringBuffer(indent).append(" ").toString()); } for (Iterator i=ClusterList.iterator(); i.hasNext(); ) { ClusterImpl cluster = (ClusterImpl)i.next(); cluster.writeXMLRepresentation(writer, new StringBuffer(indent).append(" ").toString()); } writer.write(indent); writer.write("</Group>\n"); } private String escapeAttributeValue(String attributeValue) { String returnValue = attributeValue; for (int i = 0; i < returnValue.length(); i++) { char ch = returnValue.charAt(i); if (ch < 0x20) { if ( (ch != 0x09) && (ch != 0x0a) && (ch != 0x0d) ) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -