KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > util > diff > Difference


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.util.diff;
5
6 import com.tc.util.Assert;
7
8 /**
9  * Represents a difference between two objects somewhere in their object graphs.
10  */

11 public abstract class Difference {
12
13   private final DifferenceContext where;
14
15   public Difference(DifferenceContext where) {
16     Assert.assertNotNull(where);
17     this.where = where;
18   }
19
20   public DifferenceContext where() {
21     return this.where;
22   }
23
24   public abstract Object JavaDoc a();
25   public abstract Object JavaDoc b();
26   public abstract String JavaDoc toString();
27   
28   public boolean equals(Object JavaDoc that) {
29     if (! (that instanceof Difference)) return false;
30     
31     Difference diffThat = (Difference) that;
32     
33     return this.where.rawEquals(diffThat.where);
34   }
35
36 }
Popular Tags