1 package net.jaekl.cfb.xml;
3 import java.io.PrintWriter;
5 import org.xml.sax.Attributes;
7 import net.jaekl.cfb.util.Util;
8 import net.jaekl.qd.xml.MissingAttributeException;
9 import net.jaekl.qd.xml.ParseResult;
10 import net.jaekl.qd.xml.XmlParseException;
12 public class LocalVariable extends ParseResult {
14 static final String TAG = "LocalVariable";
15 static final String[] INTERNAL = { };
16 static final Object[][] EXTERNAL = { };
18 static final String NAME = "name";
19 static final String ROLE = "role";
25 public LocalVariable() {
26 super(TAG, INTERNAL, EXTERNAL);
29 m_name = m_role = null;
32 public LocalVariable(Long id, String name, String role) {
33 super(TAG, INTERNAL, EXTERNAL);
40 public Long getId() { return m_id; }
41 public String getName() { return m_name; }
42 public String getRole() { return m_role; }
45 public void handleMainAttributes(Attributes attr)
46 throws MissingAttributeException
48 m_name = getRequiredAttr(TAG, attr, NAME);
49 m_role = getRequiredAttr(TAG, attr, ROLE);
53 public void endContents(String uri, String localName, String qName, String chars)
54 throws XmlParseException
59 public void endExternal(String uri, String localName, String qName)
60 throws XmlParseException
66 public void dump(PrintWriter pw, int indent)
68 super.dump(pw, indent);
69 String tab = String.format("%" + (indent + 2) + "s", "");
71 pw.println(tab + NAME + "=" + m_name);
72 pw.println(tab + ROLE + "=" + m_role);
76 public boolean equals(Object obj)
81 if (obj instanceof LocalVariable) {
82 LocalVariable that = (LocalVariable)obj;
83 return ( Util.objsAreEqual(this.m_name, that.m_name)
84 && Util.objsAreEqual(this.m_role, that.m_role) );
92 return ( (Util.objHashCode(m_name)) ^ (Util.objHashCode(m_role)) );