/* (non-Javadoc)
@see org.deckfour.xes.util.XRegistry#areEqual(java.lang.Object, java.lang.Object)
1985
@Override
	protected boolean areEqual(XSerializer a, XSerializer b) {
		return a.getClass().equals(b.getClass());
	}
898673
public static boolean objectsNotEqual(final Object one, final Object two) {

        return (one == null) ? (two != null) : (!one.equals(two));

    }
113431
public boolean notEquals(XObject obj2)
          throws javax.xml.transform.TransformerException
  {

    // In order to handle the 'all' semantics of 
    // nodeset comparisons, we always call the 
    // nodeset function.
    if (obj2.getType() == XObject.CLASS_NODESET)
      return obj2.notEquals(this);

    return !equals(obj2);
  }
1036131
private static boolean objectsEquals(Object a, Object b) {
        return (a == b) || (a != null && a.equals(b));
    }
1813
@Override
    public boolean isEqual(Object o) {
        if (o == this) {
            return true;
        }
        if (!(o instanceof TemporalParameter)) {
            return false;
        }

        TemporalParameter p = (TemporalParameter) o;
        return super.isEqual(p)
                && (this.value == p.value
                || (this.value != null && this.value.equals(p.value)));
    }
90167
private boolean codeEquals(Code child, Code parent) {

        if (parent == null) {
            return false;
        }

        byte[] childBytes = child.getCode();
        byte[] parentBytes = parent.getCode();

        if ((childBytes == null) || (parentBytes == null)) {
            return false;
        }

        if (childBytes.length != parentBytes.length) {
            return false;
        }

        InstructionHandle[] childihs = new InstructionList(childBytes).getInstructionHandles();
        InstructionHandle[] parentihs = new InstructionList(parentBytes).getInstructionHandles();

        if (childihs.length != parentihs.length) {
            return false;
        }

        for (int i = 0; i < childihs.length; i++) {
            InstructionHandle childih = childihs[i];
            InstructionHandle parentih = parentihs[i];
            Instruction childin = childih.getInstruction();
            Instruction parentin = parentih.getInstruction();

            if (!childin.getName().equals(parentin.getName())) {
                return false;
            }

            if (childin instanceof FieldInstruction) {
                String childFName = ((FieldInstruction) childin).getFieldName(childPoolGen);
                String parentFName = ((FieldInstruction) parentin).getFieldName(parentPoolGen);
                if (!childFName.equals(parentFName)) {
                    return false;
                }
                String childFSig = ((FieldInstruction) childin).getSignature(childPoolGen);
                String parentFSig = ((FieldInstruction) parentin).getSignature(parentPoolGen);
                if (!childFSig.equals(parentFSig)) {
                    return false;
                }

                if (childFSig.startsWith(Values.SIG_QUALIFIED_CLASS_PREFIX) || childFSig.startsWith(Values.SIG_ARRAY_PREFIX)) {
                    ReferenceType childRefType = ((FieldInstruction) childin).getReferenceType(childPoolGen);
                    ReferenceType parentRefType = ((FieldInstruction) parentin).getReferenceType(parentPoolGen);
                    if (!childRefType.getSignature().equals(parentRefType.getSignature())) {
                        return false;
                    }
                }
            } else if (childin instanceof InvokeInstruction) {
                String childClassName = ((InvokeInstruction) childin).getClassName(childPoolGen);
                String parentClassName = ((InvokeInstruction) parentin).getClassName(parentPoolGen);
                if (!childClassName.equals(parentClassName)) {
                    return false;
                }
                String childMethodName = ((InvokeInstruction) childin).getMethodName(childPoolGen);
                String parentMethodName = ((InvokeInstruction) parentin).getMethodName(parentPoolGen);
                if (!childMethodName.equals(parentMethodName)) {
                    return false;
                }
                String childSignature = ((InvokeInstruction) childin).getSignature(childPoolGen);
                String parentSignature = ((InvokeInstruction) parentin).getSignature(parentPoolGen);
                if (!childSignature.equals(parentSignature)) {
                    return false;
                }
            } else if (childin instanceof LDC) {
                Type childType = ((LDC) childin).getType(childPoolGen);
                Type parentType = ((LDC) parentin).getType(parentPoolGen);
                if (!childType.equals(parentType)) {
                    return false;
                }

                Object childValue = ((LDC) childin).getValue(childPoolGen);
                Object parentValue = ((LDC) parentin).getValue(parentPoolGen);

                if (childValue instanceof ConstantClass) {
                    ConstantClass childClass = (ConstantClass) childValue;
                    ConstantClass parentClass = (ConstantClass) parentValue;
                    if (!childClass.getBytes(childPoolGen.getConstantPool()).equals(parentClass.getBytes(parentPoolGen.getConstantPool()))) {
                        return false;
                    }
                } else if (!childValue.equals(parentValue)) {
                    return false;
                }
                // TODO: Other Constant types
            } else if (childin instanceof LDC2_W) {
                Type childType = ((LDC2_W) childin).getType(childPoolGen);
                Type parentType = ((LDC2_W) parentin).getType(parentPoolGen);
                if (!childType.equals(parentType)) {
                    return false;
                }

                Object childValue = ((LDC2_W) childin).getValue(childPoolGen);
                Object parentValue = ((LDC2_W) parentin).getValue(parentPoolGen);

                if (!childValue.equals(parentValue)) {
                    return false;
                }

            } else {
                if (!childin.equals(parentin)) {
                    return false;
                }
            }
        }

        return true;
    }
778892
private boolean annotationEquals(Object object) {
        if (object == null 
                    || !(object instanceof Annotation) 
                    || !annotationType.equals(((Annotation) object).annotationType())) {
                     return false;
         }
        
        for (Map.Entry<String, Method> entry : attributes.entrySet()) {
            String methodName = entry.getKey();
            Method method = entry.getValue();
            Object otherValue;
            try {
                otherValue = method.invoke(object);
                Object value = attributeData.get(methodName);
                if (!attributeEquals(value, otherValue)) {
                    return false;
                }
            } catch (Exception e) {
               return false;
            } 
           
        }
        return true;
    }
160431
@Override
	protected boolean areEqual(XParser a, XParser b) {
		return a.getClass().equals(b.getClass());
	}
396936
@Override
  public void isEqualTo(@NullableDecl Object other) {
    if (Objects.equal(actual(), other)) {
      return;
    }

    // Fail but with a more descriptive message:

    if (!(other instanceof Map)) {
      super.isEqualTo(other);
      return;
    }

    boolean mapEquals = containsEntriesInAnyOrder((Map<?, ?>) other, "is equal to", false);
    if (mapEquals) {
      failWithoutActual(
          simpleFact(
              lenientFormat(
                  "Not true that %s is equal to <%s>. It is equal according to the contract of "
                      + "Map.equals(Object), but this implementation returned false",
                  actualAsString(), other)));
    }
  }
971197
public static boolean isEqualsMethod(Method method) {
		if (method == null || false == method.getName().equals("equals")) {
			return false;
		}
		final Class<?>[] paramTypes = method.getParameterTypes();
		return (1 == paramTypes.length && paramTypes[0] == Object.class);
	}
898684
public static boolean isEqual(byte ba1[], byte ba2[]) {
		if(ba1.length!=ba2.length)return false;
		for(int i = 0;i<ba1.length; ++i) {
			if(ba1[i]!=ba2[i])return false;
		}
		return true;
	}
1233627
public static boolean isArrayEquals (@Nullable final Object aHeadArray, @Nullable final Object aTailArray)
  {
    // Same objects?
    if (EqualsHelper.identityEqual (aHeadArray, aTailArray))
      return true;

    // Any of the null -> different because they are not both null
    if (aHeadArray == null || aTailArray == null)
      return false;

    // If any of the passed object is not an array -> not equal as an array,
    // even if they are equal!
    if (!isArray (aHeadArray) || !isArray (aTailArray))
      return false;

    // Different component type?
    if (!aHeadArray.getClass ().getComponentType ().equals (aTailArray.getClass ().getComponentType ()))
      return false;

    // Different length?
    final int nLength = Array.getLength (aHeadArray);
    if (nLength != Array.getLength (aTailArray))
      return false;

    // Compare step by step
    for (int i = 0; i < nLength; i++)
    {
      final Object aItem1 = Array.get (aHeadArray, i);
      final Object aItem2 = Array.get (aTailArray, i);
      if (isArray (aItem1) && isArray (aItem2))
      {
        // Recursive call
        if (!isArrayEquals (aItem1, aItem2))
          return false;
      }
      else
      {
        // Use equals implementation
        if (!EqualsHelper.equals (aItem1, aItem2))
          return false;
      }
    }

    // No differences found!
    return true;
  }
233705
@GwtIncompatible("incompatible method")
    private static boolean arrayMemberEquals(final Class<?> componentType, final Object o1, final Object o2) {
        if (componentType.isAnnotation()) {
            return annotationArrayMemberEquals((Annotation[]) o1, (Annotation[]) o2);
        }
        if (componentType.equals(Byte.TYPE)) {
            return Arrays.equals((byte[]) o1, (byte[]) o2);
        }
        if (componentType.equals(Short.TYPE)) {
            return Arrays.equals((short[]) o1, (short[]) o2);
        }
        if (componentType.equals(Integer.TYPE)) {
            return Arrays.equals((int[]) o1, (int[]) o2);
        }
        if (componentType.equals(Character.TYPE)) {
            return Arrays.equals((char[]) o1, (char[]) o2);
        }
        if (componentType.equals(Long.TYPE)) {
            return Arrays.equals((long[]) o1, (long[]) o2);
        }
        if (componentType.equals(Float.TYPE)) {
            return Arrays.equals((float[]) o1, (float[]) o2);
        }
        if (componentType.equals(Double.TYPE)) {
            return Arrays.equals((double[]) o1, (double[]) o2);
        }
        if (componentType.equals(Boolean.TYPE)) {
            return Arrays.equals((boolean[]) o1, (boolean[]) o2);
        }
        return Arrays.equals((Object[]) o1, (Object[]) o2);
    }
1062662
private boolean isEqual(Object o1, Object o2)
    {
        // Both null - they are equal
        if (o1 == null && o2 == null)
        {
            return true;
        }
        // One is null and the other isn't - they are not equal
        if ((o1 == null && o2 != null) || (o1 != null && o2 == null))
        {
            return false;
        }

        // Otherwise fight it out amongst themselves
        return o1.equals(o2);
    }
441119
public static <T extends MethodDescription> ElementMatcher.Junction<T> isEquals() {
        return named("equals").and(takesArguments(TypeDescription.OBJECT)).and(returns(boolean.class));
    }
195587
public static boolean equal(final Throwable ex1, final Throwable ex2) {
        if (ex1 == ex2) {
            return true;
        }
        if (ex1 == null) {
            if (ex2 != null) {
                return false;
            }
        } else if (ex2 == null) {
            if (ex1 != null) {
                return false;
            }
        } else {
            if (ex1.getClass() != ex2.getClass()) {
                return false;
            }
            if (ex1.getMessage() == null) {
                if (ex2.getMessage() != null) {
                    return false;
                }
            } else if (!ex1.getMessage().equals(ex2.getMessage())) {
                return false;
            }
            if (!equal(ex1.getCause(), ex2.getCause())) {
                return false;
            }
        }
        return true;
    }
950952
private boolean isEqual(Object a, Object b) {

        if (a == null) {
            return (b == null);
        }
        if (b == null) {
            return false;
        }
        return a.equals(b);
    }