ref_send API 2.17
defensive programming in Java

org.joe_e
Class Struct

java.lang.Object
  extended by org.joe_e.Struct
All Implemented Interfaces:
Selfless
Direct Known Subclasses:
AllTypes, CallSite, Deferred, Do, DrumFactory, Event, Export, JSONDeserializer, JSONSerializer, Link, SeriesFactory, Syntax, Trace, TurnCounter, Vat, Verbose

public abstract class Struct
extends java.lang.Object
implements Selfless

This abstract class contains implementations of the equals() and hashCode() methods that satisfy the Selfless interface. The provided equals() method computes equality of all fields using reflection.


Method Summary
 boolean equals(java.lang.Object other)
          Tests for equality with another object.
 int hashCode()
          Calculates the hash code.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

equals

public final boolean equals(java.lang.Object other)
Tests for equality with another object. An obect is equal to this one if it is of identical type and each field is equal for the two objects. The objects' fields are equal if both are null, or if their values return true for equals(). This implementation uses reflection to work for any subclass of Struct.

Overrides:
equals in class java.lang.Object
Parameters:
other - candidate object
Returns:
true if it is equal to this object

hashCode

public final int hashCode()
Calculates the hash code. This method will satisfy the contract of the hashCode method for any subclass of Struct. (two structs that are equal() structs will always have the same hashCode). The precise return value of this method is unspecified, and may change in future releases.

Specified by:
hashCode in interface Selfless
Overrides:
hashCode in class java.lang.Object
Returns:
a hash value

ref_send API 2.17
defensive programming in Java

Submit a bug or feature, or get help

Copyright 1998-2009 Waterken Inc. under the terms of the MIT X license.