jInfer

cz.cuni.mff.ksi.jinfer.base.utils
Class EqualityUtils

java.lang.Object
  extended by cz.cuni.mff.ksi.jinfer.base.utils.EqualityUtils

public final class EqualityUtils
extends Object

Utility class to test equalities in XML representation.

See the integer flags used to specified which features to ignore while comparing. Example usage:

EqualityUtils.sameElements(e1, e2, EqualityUtils.IGNORE_METADATA | EqualityUtils.IGNORE_NAME)

to ignore metadata and names of provided elements.


Field Summary
static int IGNORE_ATTRIBUTES
          While comparing, ignore Element.getAttributes().
static int IGNORE_CONTENT
          While comparing, ignore SimpleData.getContent().
static int IGNORE_CONTENT_TYPE
          While comparing, ignore SimpleData.getContentType().
static int IGNORE_CONTEXT
          While comparing, ignore AbstractNamedNode.getContext().
static int IGNORE_METADATA
          While comparing, ignore AbstractNamedNode.getMetadata().
static int IGNORE_NAME
          While comparing, ignore AbstractNamedNode.getName().
static int IGNORE_SUBNODES
          While comparing, ignore Element.getSubnodes().
 
Method Summary
static boolean sameElements(Element e1, Element e2, int ignore)
          Compares two elements, ignoring specified features.
static boolean sameIntervals(RegexpInterval i1, RegexpInterval i2)
          Compare two intervals if they have equal minimum and maximum.
static boolean sameSimpleData(SimpleData sd1, SimpleData sd2, int ignore)
          Compares two simple data, ignoring specified features.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IGNORE_NAME

public static final int IGNORE_NAME
While comparing, ignore AbstractNamedNode.getName().

See Also:
Constant Field Values

IGNORE_CONTEXT

public static final int IGNORE_CONTEXT
While comparing, ignore AbstractNamedNode.getContext().

See Also:
Constant Field Values

IGNORE_METADATA

public static final int IGNORE_METADATA
While comparing, ignore AbstractNamedNode.getMetadata().

See Also:
Constant Field Values

IGNORE_ATTRIBUTES

public static final int IGNORE_ATTRIBUTES
While comparing, ignore Element.getAttributes().

See Also:
Constant Field Values

IGNORE_SUBNODES

public static final int IGNORE_SUBNODES
While comparing, ignore Element.getSubnodes().

See Also:
Constant Field Values

IGNORE_CONTENT_TYPE

public static final int IGNORE_CONTENT_TYPE
While comparing, ignore SimpleData.getContentType().

See Also:
Constant Field Values

IGNORE_CONTENT

public static final int IGNORE_CONTENT
While comparing, ignore SimpleData.getContent().

See Also:
Constant Field Values
Method Detail

sameElements

public static boolean sameElements(Element e1,
                                   Element e2,
                                   int ignore)
Compares two elements, ignoring specified features.

Parameters:
e1 - Element 1 to compare.
e2 - Element 2 to compare.
ignore - Bitmap of flags to compare. Combine multiple flags with a bitwise OR (pipe character "|").
Returns:
True if provided elements are same, ignoring specified features.

sameSimpleData

public static boolean sameSimpleData(SimpleData sd1,
                                     SimpleData sd2,
                                     int ignore)
Compares two simple data, ignoring specified features.

Parameters:
sd1 - Simple data 1 to compare.
sd2 - Simple data 2 to compare.
ignore - Bitmap of flags to compare. Combine multiple flags with a bitwise OR (pipe character "|").
Returns:
True if provided simple data are same, ignoring specified features.

sameIntervals

public static boolean sameIntervals(RegexpInterval i1,
                                    RegexpInterval i2)
Compare two intervals if they have equal minimum and maximum. Intervals must not be null. If both intervals are unbounded and they have the same minimum, they are considered equal.

Parameters:
i1 - First interval to be compared.
i2 - Second interval to be compared.
Returns:
True if minimums and maximums of both intervals match, false otherwise.

jInfer

Generated on Fri Dec 9 00:01:25 CET 2011