CompositeKey Class Reference

Detailed Description

Key class that consists of a primary and secondary component.

Two instances of CompositeKey are considered to be equal iff both the primary and secondary components of the two instances are considered equal. Additionally, the hash code of a CompositeKey takes into the consideration the hash codes of its two components. Finally, the CompositeKey class implements KeyAssociation by returning the primary component.

Whenever it is invoked on the same Object more than once during an execution of an application, the hashCode method must consistently return the same value, provided no information used in equals comparisons on the object is modified. This value need not remain consistent from one execution of an application to another execution of the same application.

If two Objects are equal according to the equals method, then calling the hashCode method on each of the two Objects must produce the same value.

It is not required that if two Objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct results. However, the programmer should be aware that producing distinct results for unequal objects may improve the performance of hash-based containers.

Output a human-readable description of this Object to the given stream.

coherence::lang::operator<<(std::ostream, Object::View) is defined and will call into the toStream method, to output Objects. If a managed String object is desired, the COH_TO_STRING macro can be used to build up a String from streamable contents.