Opened 13 years ago

Closed 13 years ago

#249 closed defect (fixed)

review discretized function equals method

Reported by: Kevin Milner Owned by: Kevin Milner
Priority: major Milestone: OpenSHA 1.2
Component: commons Version:
Keywords: Cc:


Currently all of the discretized functions' equals() method only checks that the name and info are equal (or both null). It should check that the contents of the function are equal.

The fix is easy, but we'll have to make sure there isn't any code that relies on equals() not checking this.

We also have to decide if equals should:

  1. simply check contents
  2. check contents, and check that name is the same
  3. check contents, and check that name and info are the same


Change History (2)

comment:1 Changed 13 years ago by Peter Powers

I have a hard time envisioning a situation where one would want equals to return true just based on name and info, but that's just me and I don't know the history. I would imagine in most cases one would care most about the data, but it's probably unwise to remove the info/name test. Looking at ArbDiscFunc?, I see the equals implementations is the standard verbose isti implementation.


AbstractXYDataSet should implement the base case equals:

  • as a matter of practice and principal (this == obj) should always come first
  • test name, then info, and lastly data values using iterators

Remove equals from arbDiscFunc OR replace contenst with call to super and add instanceof ArbDiscFunc? test.

comment:2 Changed 13 years ago by Kevin Milner

Resolution: fixed
Status: newclosed

ok I implemented equals as Peter recommended in [7737]. we have to keep a careful eye out for any unexpected side effects from this change.

Note: See TracTickets for help on using tickets.