X-Git-Url: http://jaekl.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=prod%2Fnet%2Fjaekl%2Fcfb%2Fxml%2FLocalVariable.java;h=8043821844c89f0085292dae231058a6a5bce847;hb=f1c4313e9229dd2d5f7fd984169cbdb89fef4cd5;hp=fb198688068f58353ed80c3dd93bdbb65d4db1a1;hpb=5bc9bbe3fd54b9fc7aa3b92d2d37e95c41b9645a;p=cfb.git diff --git a/prod/net/jaekl/cfb/xml/LocalVariable.java b/prod/net/jaekl/cfb/xml/LocalVariable.java index fb19868..8043821 100644 --- a/prod/net/jaekl/cfb/xml/LocalVariable.java +++ b/prod/net/jaekl/cfb/xml/LocalVariable.java @@ -4,6 +4,7 @@ import java.io.PrintWriter; import org.xml.sax.Attributes; +import net.jaekl.cfb.util.Util; import net.jaekl.qd.xml.MissingAttributeException; import net.jaekl.qd.xml.ParseResult; import net.jaekl.qd.xml.XmlParseException; @@ -17,15 +18,29 @@ public class LocalVariable extends ParseResult { static final String NAME = "name"; static final String ROLE = "role"; + Long m_id; String m_name; String m_role; public LocalVariable() { super(TAG, INTERNAL, EXTERNAL); + m_id = null; m_name = m_role = null; } + public LocalVariable(Long id, String name, String role) { + super(TAG, INTERNAL, EXTERNAL); + + m_id = id; + m_name = name; + m_role = role; + } + + public Long getId() { return m_id; } + public String getName() { return m_name; } + public String getRole() { return m_role; } + @Override public void handleMainAttributes(Attributes attr) throws MissingAttributeException @@ -56,4 +71,24 @@ public class LocalVariable extends ParseResult { pw.println(tab + NAME + "=" + m_name); pw.println(tab + ROLE + "=" + m_role); } + + @Override + public boolean equals(Object obj) + { + if (null == obj) { + return false; + } + if (obj instanceof LocalVariable) { + LocalVariable that = (LocalVariable)obj; + return ( Util.objsAreEqual(this.m_name, that.m_name) + && Util.objsAreEqual(this.m_role, that.m_role) ); + } + return false; + } + + @Override + public int hashCode() + { + return ( (Util.objHashCode(m_name)) ^ (Util.objHashCode(m_role)) ); + } }