Class Equality

java.lang.Object
org.wikidata.wdtk.datamodel.helpers.Equality

public class Equality extends Object
Static class for checking the equality of arbitrary data objects using only their interfaces. This can be used to implement the equals() method of arbitrary interface implementations. More efficient solutions might exist if the object that implements an interface is of a specific known type, but the methods here could always be used as a fallback or default.

Note that it is desired that different implementations of the same interface are treated as equal if they contain the same data.

Author:
Markus Kroetzsch
  • Constructor Details

    • Equality

      public Equality()
  • Method Details

    • equalsEntityIdValue

      public static boolean equalsEntityIdValue(EntityIdValue o1, Object o2)
      Returns true if the parameters are two EntityIdValue objects with exactly the same data. It does not matter if they are different implementations of the interface as long as their content is the same.
      Parameters:
      o1 - the first object to compare
      o2 - the second object to compare
      Returns:
      true if both objects are equal
    • equalsDatatypeIdValue

      public static boolean equalsDatatypeIdValue(DatatypeIdValue o1, Object o2)
      Returns true if the parameters are two DatatypeIdValue objects with exactly the same data. It does not matter if they are different implementations of the interface as long as their content is the same.
      Parameters:
      o1 - the first object to compare
      o2 - the second object to compare
      Returns:
      true if both objects are equal
    • equalsTimeValue

      public static boolean equalsTimeValue(TimeValue o1, Object o2)
      Returns true if the parameters are two TimeValue objects with exactly the same data. It does not matter if they are different implementations of the interface as long as their content is the same.
      Parameters:
      o1 - the first object to compare
      o2 - the second object to compare
      Returns:
      true if both objects are equal
    • equalsGlobeCoordinatesValue

      public static boolean equalsGlobeCoordinatesValue(GlobeCoordinatesValue o1, Object o2)
      Returns true if the parameters are two GlobeCoordinatesValue objects with exactly the same data. It does not matter if they are different implementations of the interface as long as their content is the same.
      Parameters:
      o1 - the first object to compare
      o2 - the second object to compare
      Returns:
      true if both objects are equal
    • equalsStringValue

      public static boolean equalsStringValue(StringValue o1, Object o2)
      Returns true if the parameters are two StringValue objects with exactly the same data. It does not matter if they are different implementations of the interface as long as their content is the same.
      Parameters:
      o1 - the first object to compare
      o2 - the second object to compare
      Returns:
      true if both objects are equal
    • equalsMonolingualTextValue

      public static boolean equalsMonolingualTextValue(MonolingualTextValue o1, Object o2)
      Returns true if the parameters are two MonolingualTextValue objects with exactly the same data. It does not matter if they are different implementations of the interface as long as their content is the same.
      Parameters:
      o1 - the first object to compare
      o2 - the second object to compare
      Returns:
      true if both objects are equal
    • equalsQuantityValue

      public static boolean equalsQuantityValue(QuantityValue o1, Object o2)
      Returns true if the parameters are two QuantityValue objects with exactly the same data. It does not matter if they are different implementations of the interface as long as their content is the same.
      Parameters:
      o1 - the first object to compare
      o2 - the second object to compare
      Returns:
      true if both objects are equal
    • equalsValueSnak

      public static boolean equalsValueSnak(ValueSnak o1, Object o2)
      Returns true if the parameters are two ValueSnak objects with exactly the same data. It does not matter if they are different implementations of the interface as long as their content is the same.
      Parameters:
      o1 - the first object to compare
      o2 - the second object to compare
      Returns:
      true if both objects are equal
    • equalsSomeValueSnak

      public static boolean equalsSomeValueSnak(SomeValueSnak o1, Object o2)
      Returns true if the parameters are two SomeValueSnak objects with exactly the same data. It does not matter if they are different implementations of the interface as long as their content is the same.
      Parameters:
      o1 - the first object to compare
      o2 - the second object to compare
      Returns:
      true if both objects are equal
    • equalsNoValueSnak

      public static boolean equalsNoValueSnak(NoValueSnak o1, Object o2)
      Returns true if the parameters are two NoValueSnak objects with exactly the same data. It does not matter if they are different implementations of the interface as long as their content is the same.
      Parameters:
      o1 - the first object to compare
      o2 - the second object to compare
      Returns:
      true if both objects are equal
    • equalsSnakGroup

      public static boolean equalsSnakGroup(SnakGroup o1, Object o2)
      Returns true if the parameters are two SnakGroup objects with exactly the same data. It does not matter if they are different implementations of the interface as long as their content is the same.
      Parameters:
      o1 - the first object to compare
      o2 - the second object to compare
      Returns:
      true if both objects are equal
    • equalsClaim

      public static boolean equalsClaim(Claim o1, Object o2)
      Returns true if the parameters are two Claim objects with exactly the same data. It does not matter if they are different implementations of the interface as long as their content is the same.
      Parameters:
      o1 - the first object to compare
      o2 - the second object to compare
      Returns:
      true if both objects are equal
    • equalsReference

      public static boolean equalsReference(Reference o1, Object o2)
      Returns true if the parameters are two Reference objects with exactly the same data. It does not matter if they are different implementations of the interface as long as their content is the same.
      Parameters:
      o1 - the first object to compare
      o2 - the second object to compare
      Returns:
      true if both objects are equal
    • equalsStatement

      public static boolean equalsStatement(Statement o1, Object o2)
      Returns true if the parameters are two Statement objects with exactly the same data. It does not matter if they are different implementations of the interface as long as their content is the same.
      Parameters:
      o1 - the first object to compare
      o2 - the second object to compare
      Returns:
      true if both objects are equal
    • equalsStatementGroup

      public static boolean equalsStatementGroup(StatementGroup o1, Object o2)
      Returns true if the parameters are two StatementGroup objects with exactly the same data. It does not matter if they are different implementations of the interface as long as their content is the same. Note that this includes the statement id, so that two statement objects that "say the same thing" might still be unequal if they have different ids.
      Parameters:
      o1 - the first object to compare
      o2 - the second object to compare
      Returns:
      true if both objects are equal
    • equalsSiteLink

      public static boolean equalsSiteLink(SiteLink o1, Object o2)
      Returns true if the parameters are two SiteLink objects with exactly the same data. It does not matter if they are different implementations of the interface as long as their content is the same.
      Parameters:
      o1 - the first object to compare
      o2 - the second object to compare
      Returns:
      true if both objects are equal
    • equalsPropertyDocument

      public static boolean equalsPropertyDocument(PropertyDocument o1, Object o2)
      Returns true if the parameters are two PropertyDocument objects with exactly the same data. It does not matter if they are different implementations of the interface as long as their content is the same.
      Parameters:
      o1 - the first object to compare
      o2 - the second object to compare
      Returns:
      true if both objects are equal
    • equalsItemDocument

      public static boolean equalsItemDocument(ItemDocument o1, Object o2)
      Returns true if the parameters are two ItemDocument objects with exactly the same data. It does not matter if they are different implementations of the interface as long as their content is the same.
      Parameters:
      o1 - the first object to compare
      o2 - the second object to compare
      Returns:
      true if both objects are equal
    • equalsLexemeDocument

      public static boolean equalsLexemeDocument(LexemeDocument o1, Object o2)
      Returns true if the parameters are two LexemeDocument objects with exactly the same data. It does not matter if they are different implementations of the interface as long as their content is the same.
      Parameters:
      o1 - the first object to compare
      o2 - the second object to compare
      Returns:
      true if both objects are equal
    • equalsFormDocument

      public static boolean equalsFormDocument(FormDocument o1, Object o2)
      Returns true if the parameters are two FormDocument objects with exactly the same data. It does not matter if they are different implementations of the interface as long as their content is the same.
      Parameters:
      o1 - the first object to compare
      o2 - the second object to compare
      Returns:
      true if both objects are equal
    • equalsSenseDocument

      public static boolean equalsSenseDocument(SenseDocument o1, Object o2)
      Returns true if the parameters are two SenseDocument objects with exactly the same data. It does not matter if they are different implementations of the interface as long as their content is the same.
      Parameters:
      o1 - the first object to compare
      o2 - the second object to compare
      Returns:
      true if both objects are equal
    • equalsMediaInfoDocument

      public static boolean equalsMediaInfoDocument(MediaInfoDocument o1, Object o2)
      Returns true if the parameters are two MediaInfoDocument objects with exactly the same data. It does not matter if they are different implementations of the interface as long as their content is the same.
      Parameters:
      o1 - the first object to compare
      o2 - the second object to compare
      Returns:
      true if both objects are equal
    • equalsEntityRedirectDocument

      public static boolean equalsEntityRedirectDocument(EntityRedirectDocument o1, Object o2)
      Returns true if the parameters are two EntityRedirectDocument objects with exactly the same data. It does not matter if they are different implementations of the interface as long as their content is the same.
      Parameters:
      o1 - the first object to compare
      o2 - the second object to compare
      Returns:
      true if both objects are equal
    • equalsTermUpdate

      public static boolean equalsTermUpdate(TermUpdate o1, Object o2)
      Returns true if the two TermUpdate objects contain exactly the same data. It does not matter whether they are different implementations of the interface as long as their content is the same.
      Parameters:
      o1 - the first object to compare
      o2 - the second object to compare
      Returns:
      true if both objects are equal
    • equalsAliasUpdate

      public static boolean equalsAliasUpdate(AliasUpdate o1, Object o2)
      Returns true if the two AliasUpdate objects contain exactly the same data. It does not matter whether they are different implementations of the interface as long as their content is the same.
      Parameters:
      o1 - the first object to compare
      o2 - the second object to compare
      Returns:
      true if both objects are equal
    • equalsStatementUpdate

      public static boolean equalsStatementUpdate(StatementUpdate o1, Object o2)
      Returns true if the two StatementUpdate objects contain exactly the same data. It does not matter whether they are different implementations of the interface as long as their content is the same.
      Parameters:
      o1 - the first object to compare
      o2 - the second object to compare
      Returns:
      true if both objects are equal
    • equalsMediaInfoUpdate

      public static boolean equalsMediaInfoUpdate(MediaInfoUpdate o1, Object o2)
      Returns true if the two MediaInfoUpdate objects contain exactly the same data. It does not matter whether they are different implementations of the interface as long as their content is the same.
      Parameters:
      o1 - the first object to compare
      o2 - the second object to compare
      Returns:
      true if both objects are equal
    • equalsItemUpdate

      public static boolean equalsItemUpdate(ItemUpdate o1, Object o2)
      Returns true if the two ItemUpdate objects contain exactly the same data. It does not matter whether they are different implementations of the interface as long as their content is the same.
      Parameters:
      o1 - the first object to compare
      o2 - the second object to compare
      Returns:
      true if both objects are equal
    • equalsPropertyUpdate

      public static boolean equalsPropertyUpdate(PropertyUpdate o1, Object o2)
      Returns true if the two PropertyUpdate objects contain exactly the same data. It does not matter whether they are different implementations of the interface as long as their content is the same.
      Parameters:
      o1 - the first object to compare
      o2 - the second object to compare
      Returns:
      true if both objects are equal
    • equalsSenseUpdate

      public static boolean equalsSenseUpdate(SenseUpdate o1, Object o2)
      Returns true if the two SenseUpdate objects contain exactly the same data. It does not matter whether they are different implementations of the interface as long as their content is the same.
      Parameters:
      o1 - the first object to compare
      o2 - the second object to compare
      Returns:
      true if both objects are equal
    • equalsFormUpdate

      public static boolean equalsFormUpdate(FormUpdate o1, Object o2)
      Returns true if the two FormUpdate objects contain exactly the same data. It does not matter whether they are different implementations of the interface as long as their content is the same.
      Parameters:
      o1 - the first object to compare
      o2 - the second object to compare
      Returns:
      true if both objects are equal
    • equalsLexemeUpdate

      public static boolean equalsLexemeUpdate(LexemeUpdate o1, Object o2)
      Returns true if the two LexemeUpdate objects contain exactly the same data. It does not matter whether they are different implementations of the interface as long as their content is the same.
      Parameters:
      o1 - the first object to compare
      o2 - the second object to compare
      Returns:
      true if both objects are equal