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";
24 public LocalVariable() {
25 super(TAG, INTERNAL, EXTERNAL);
27 m_name = m_role = null;
30 public String getName() { return m_name; }
31 public String getRole() { return m_role; }
34 public void handleMainAttributes(Attributes attr)
35 throws MissingAttributeException
37 m_name = getRequiredAttr(TAG, attr, NAME);
38 m_role = getRequiredAttr(TAG, attr, ROLE);
42 public void endContents(String uri, String localName, String qName, String chars)
43 throws XmlParseException
48 public void endExternal(String uri, String localName, String qName)
49 throws XmlParseException
55 public void dump(PrintWriter pw, int indent)
57 super.dump(pw, indent);
58 String tab = String.format("%" + (indent + 2) + "s", "");
60 pw.println(tab + NAME + "=" + m_name);
61 pw.println(tab + ROLE + "=" + m_role);
65 public boolean equals(Object obj)
70 if (obj instanceof LocalVariable) {
71 LocalVariable that = (LocalVariable)obj;
72 return ( Util.objsAreEqual(this.m_name, that.m_name)
73 && Util.objsAreEqual(this.m_role, that.m_role) );
81 return ( (1 + Util.objHashCode(m_name)) * (1 + Util.objHashCode(m_role)) );