1 dojo.provide("calitha.collections.imap.ImmutableEntry");
  2 dojo.require("calitha.collections.imap.IEntry");
  3 dojo.require("calitha.collections.util");
  4 dojo.require("calitha.exception.UnsupportedOperationException");
  5 
  6 dojo.declare("calitha.collections.imap.ImmutableEntry", calitha.collections.imap.IEntry,
  7 /** @lends calitha.collections.imap.ImmutableEntry# */
  8 {
  9     /**
 10      * @constructs
 11      * @extends calitha.collections.imap.IEntry
 12      */
 13     constructor: function(/**Object*/ key, /**Object*/ value)
 14     {
 15         this._key = key;
 16         this._value = value;
 17     }
 18     ,
 19     equals: function(/**Object*/ o)
 20     {
 21         if (!calitha.collections.util.isObjectInstanceOf(o, calitha.collections.IMap.IEntry))
 22         {
 23             return false;
 24         }
 25         //noinspection UnnecessaryLocalVariableJS
 26         var entry = o;
 27         return calitha.collections.util.equals(this.getKey(), entry.getKey()) && calitha.collections.util.equals(this.getValue(), entry.getValue());
 28     }
 29     ,
 30     getKey: function()
 31     {
 32         return this._key;
 33     }
 34     ,
 35     getValue: function()
 36     {
 37         return this._value;
 38     }
 39     ,
 40     hashCode: function()
 41     {
 42         return calitha.collections.util.hashCode(this._key) ^ calitha.collections.util.hashCode(this._value);
 43     }
 44     ,
 45     setValue: function(/**Object*/ value)
 46     {
 47         throw new calitha.exception.UnsupportedOperationException(Error());
 48     }
 49     ,
 50     toString: function()
 51     {
 52         return this._key + "=" + this._value;
 53     }
 54 });
 55 
 56 /**
 57  * @function
 58  * @returns {calitha.collections.imap.ImmutableEntry}
 59  */
 60 calitha.collections.imap.ImmutableEntry.newInstance = function(/**calitha.collections.imap.IEntry*/ entry)
 61 {
 62     return new calitha.collections.imap.ImmutableEntry(entry.getKey(), entry.getValue());
 63 };
 64