protected final ComparisonState compare ( Comparison comp ) { Object controlValue = comp . getControlDetails ( ) . getValue ( ) ; Object testValue = comp . getTestDetails ( ) . getValue ( ) ; boolean equal = controlValue == null ? testValue == null : controlValue . equals ( testValue ) ; ComparisonResult initial = equal ? ComparisonResult . EQUAL : ComparisonResult . DIFFERENT ; ComparisonResult altered = getDifferenceEvaluator ( ) . evaluate ( comp , initial ) ; listeners . fireComparisonPerformed ( comp , altered ) ; return altered != ComparisonResult . EQUAL && getComparisonController ( ) . stopDiffing ( new Difference ( comp , altered ) ) ? new FinishedComparisonState ( altered ) : new OngoingComparisonState ( altered ) ; }
Compares the detail values for object equality lets the difference evaluator and comparison controller evaluate the result notifies all listeners and returns the outcome .