01: /*
02: ******************************************************************
03: Copyright (c) 2001, Jeff Martin, Tim Bacon
04: All rights reserved.
05:
06: Redistribution and use in source and binary forms, with or without
07: modification, are permitted provided that the following conditions
08: are met:
09:
10: * Redistributions of source code must retain the above copyright
11: notice, this list of conditions and the following disclaimer.
12: * Redistributions in binary form must reproduce the above
13: copyright notice, this list of conditions and the following
14: disclaimer in the documentation and/or other materials provided
15: with the distribution.
16: * Neither the name of the xmlunit.sourceforge.net nor the names
17: of its contributors may be used to endorse or promote products
18: derived from this software without specific prior written
19: permission.
20:
21: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22: "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23: LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24: FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25: COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26: INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27: BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28: LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29: CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30: LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31: ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32: POSSIBILITY OF SUCH DAMAGE.
33:
34: ******************************************************************
35: */
36:
37: package org.custommonkey.xmlunit;
38:
39: import org.w3c.dom.Node;
40:
41: /**
42: * Listener for callbacks from a
43: * {@link DifferenceEngine#compare DifferenceEngine comparison}.
44: * <br />Examples and more at <a href="http://xmlunit.sourceforge.net"/>xmlunit.sourceforge.net</a>
45: */
46: public interface DifferenceListener {
47: /**
48: * Standard return value for the <code>differenceFound</code> method.
49: * Indicates that the <code>Difference</code> is interpreted as defined
50: * in {@link DifferenceConstants DifferenceConstants}.
51: */
52: int RETURN_ACCEPT_DIFFERENCE = 0;
53: /**
54: * Override return value for the <code>differenceFound</code> method.
55: * Indicates that the nodes identified as being different should be
56: * interpreted as being identical.
57: */
58: int RETURN_IGNORE_DIFFERENCE_NODES_IDENTICAL = 1;
59: /**
60: * Override return value for the <code>differenceFound</code> method.
61: * Indicates that the nodes identified as being different should be
62: * interpreted as being similar.
63: */
64: int RETURN_IGNORE_DIFFERENCE_NODES_SIMILAR = 2;
65:
66: /**
67: * Receive notification that 2 nodes are different.
68: * @param difference a Difference instance as defined in {@link
69: * DifferenceConstants DifferenceConstants} describing the cause
70: * of the difference and containing the detail of the nodes that
71: * differ
72: * @return int one of the RETURN_... constants describing how this
73: * difference was interpreted
74: */
75: int differenceFound(Difference difference);
76:
77: /**
78: * Receive notification that a comparison between 2 nodes has been skipped
79: * because the node types are not comparable by the DifferenceEngine
80: * @param control the control node being compared
81: * @param test the test node being compared
82: * @see DifferenceEngine
83: */
84: void skippedComparison(Node control, Node test);
85:
86: }
|