kodkod.util.ints
Interface IndexedEntry<E>


public interface IndexedEntry<E>

An entry in a sparse sequence.

Author:
Emina Torlak
specfield:
index: int
value: E

Method Summary
 boolean equals(java.lang.Object o)
          Compares the specified object with this entry for equality.
 int hashCode()
          Returns the hash code value for this indexed entry.
 int index()
          Returns the index of this entry.
 E value()
          Returns the value stored in this entry.
 

Method Detail

index

int index()
Returns the index of this entry.

Returns:
this.index

value

E value()
Returns the value stored in this entry.

Returns:
this.value

equals

boolean equals(java.lang.Object o)
Compares the specified object with this entry for equality. Returns true if the given object is also an indexed entry and the two entries have the same indeces and values. More formally, two entries e1 and e2 are equal if e1.index = e2.index && e1.value = e2.value. This ensures that the equals method works properly across different implementations of the IndexedEntry interface.

Overrides:
equals in class java.lang.Object
Returns:
o in IndexedEntry && o.index = this.index && o.value = this.value

hashCode

int hashCode()
Returns the hash code value for this indexed entry. The hash code of an indexed entry e is defined to be: e.index ^ (e.value=null ? 0 : e.value.hashCode()). This ensures that e1.equals(e2) implies that e1.hashCode()==e2.hashCode() for any two IndexedEntries e1 and e2, as required by the general contract of Object.hashCode.

Overrides:
hashCode in class java.lang.Object