diff src/treecms/tree/util/NodeAttributesImpl.java @ 17:168deb591f21

commit
author shoshi
date Tue, 24 May 2011 00:33:12 +0900
parents bb9760760744
children 084de6909451
line wrap: on
line diff
--- a/src/treecms/tree/util/NodeAttributesImpl.java	Sat May 21 04:46:00 2011 +0900
+++ b/src/treecms/tree/util/NodeAttributesImpl.java	Tue May 24 00:33:12 2011 +0900
@@ -17,9 +17,15 @@
 		m_attrs = new HashMap<ByteBuffer,ByteBuffer>();
 	}
 	
+	public NodeAttributesImpl(Map<ByteBuffer,ByteBuffer> _map)
+	{
+		this();
+		m_attrs.putAll(_map);
+	}
+	
 	public NodeAttributesImpl(NodeAttributesImpl _attrs)
 	{
-		super();
+		this();
 		m_attrs.putAll(_attrs.m_attrs);
 	}
 	
@@ -78,5 +84,22 @@
 	{
 		m_attrs.clear();
 	}
-
+	
+	@Override
+	public boolean equals(Object _o)
+	{
+		if(_o instanceof NodeAttributes || _o == null){
+			return false;
+		}
+		
+		NodeAttributes attr = (NodeAttributes)_o;
+		Map<ByteBuffer,ByteBuffer> map = attr.asMap();
+		return m_attrs.equals(map);
+	}
+	
+	@Override
+	public int hashCode()
+	{
+		return m_attrs.hashCode();
+	}
 }