1 11 12 package org.eclipse.core.databinding.observable.value; 13 14 import org.eclipse.core.databinding.observable.Diffs; 15 16 20 public abstract class ValueDiff { 21 24 public ValueDiff() { 25 } 26 27 30 public abstract Object getOldValue(); 31 32 35 public abstract Object getNewValue(); 36 37 public boolean equals(Object obj) { 38 if (obj instanceof ValueDiff) { 39 ValueDiff val = (ValueDiff) obj; 40 41 return Diffs.equals(val.getNewValue(), getNewValue()) 42 && Diffs.equals(val.getOldValue(), getOldValue()); 43 44 } 45 return false; 46 } 47 48 public int hashCode() { 49 final int prime = 31; 50 int result = 1; 51 Object nv = getNewValue(); 52 Object ov = getOldValue(); 53 result = prime * result + ((nv == null) ? 0 : nv.hashCode()); 54 result = prime * result + ((ov == null) ? 0 : ov.hashCode()); 55 return result; 56 } 57 58 61 public String toString() { 62 StringBuffer buffer = new StringBuffer (); 63 buffer 64 .append(getClass().getName()) 65 .append("{oldValue [") .append(getOldValue() != null ? getOldValue().toString() : "null") .append("], newValue [") .append(getNewValue() != null ? getNewValue().toString() : "null") .append("]}"); 71 return buffer.toString(); 72 } 73 } 74 | Popular Tags |