public static <T> int indexOf(T searchedItem, T[] array) { for (int i = 0; i < array.length; i++) { T candidate = array[i]; if (NullSafeComparator.equals(candidate, searchedItem)) return i; } return -1; }
public boolean contains(E element) { for (int i = 0; i < elementCount; i++) if (NullSafeComparator.equals(buffer[i], element)) return true; return false; }
@Override public boolean evaluate(E argument) { return NullSafeComparator.equals(argument, reference); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null || getClass() != obj.getClass()) return false; @SuppressWarnings("rawtypes") MapEntry that = (MapEntry) obj; return NullSafeComparator.equals(this.key, that.key) && NullSafeComparator.equals(this.value, that.value); }
@SuppressWarnings("rawtypes") @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; final MapAccessor that = (MapAccessor) o; return NullSafeComparator.equals(this.key, that.key); }
protected void firePropertyChange(Object source, String propertyName, Object oldValue, Object newValue) { if (!NullSafeComparator.equals(oldValue, newValue)) { PropertyChangeEvent event = new PropertyChangeEvent(source, propertyName, oldValue, newValue); propertyChangeSupport.firePropertyChange(event); } }
@Override public boolean isIdentical(DBObject other) { if (this == other) return true; if (other == null || other.getClass() != this.getClass()) return false; DBPackage that = (DBPackage) other; return NullSafeComparator.equals(this.subObjectName, that.subObjectName) && this.objectId.equals(that.objectId) && NullSafeComparator.equals(this.dataObjectId, that.dataObjectId) && this.objectType.equals(that.objectType) && this.status.equals(that.status); }
public static <T> boolean ofEqualContent(List<T> list, T[] array) { if (list == null || list.isEmpty()) return (array == null || array.length == 0); if (array == null || list.size() != array.length) return false; for (int i = list.size() - 1; i >= 0; i--) if (!NullSafeComparator.equals(list.get(i), array[i])) return false; return true; }
private boolean elementNamesMatch(Element e1, Element e2) { String ln1 = e1.getLocalName(); String ln2 = e2.getLocalName(); if (ln1 != null) { if (!ln1.equals(ln2)) return false; } else if (ln2 != null) { return false; } if (namespaceRelevant && !NullSafeComparator.equals(e1.getNamespaceURI(), e2.getNamespaceURI())) return false; return true; }
@Override public boolean isIdentical(DBObject other) { if (this == other) return true; if (other == null || !(other instanceof DBForeignKeyConstraint)) return false; DBForeignKeyConstraint that = (DBForeignKeyConstraint) other; return NullSafeComparator.equals(this.name, that.name) && Arrays.equals(fkColumnNames, that.fkColumnNames) && Arrays.equals(refereeColumnNames, that.refereeColumnNames) && NullSafeComparator.equals(refereeTable.getName(), that.refereeTable.getName()); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null || !DBObject.class.isAssignableFrom(obj.getClass())) return false; DBObject that = (DBObject) obj; return NullSafeComparator.equals(this.name, that.getName()) && NullSafeComparator.equals(this.objectType, that.getObjectType()) && NullSafeComparator.equals(this.owner, that.getOwner()); }
@Override public boolean isIdentical(DBObject other) { if (this == other) return true; if (other == null || !(other instanceof DBUniqueConstraint)) return false; DBUniqueConstraint that = (DBUniqueConstraint) other; return NullSafeComparator.equals(this.name, that.name) && Arrays.equals(this.columnNames, that.columnNames) && NullSafeComparator.equals(this.getTable().getName(), that.getTable().getName()); }
public boolean isEquivalent(DBObject other) { if (this == other) return true; if (other == null || !(other instanceof DBColumn)) return false; DBColumn that = (DBColumn) other; return this.type.equals(that.getType()) && NullSafeComparator.equals(this.size, that.getSize()) && NullSafeComparator.equals(this.fractionDigits, that.getFractionDigits()); }
public E remove(String key) { E result = super.remove(key); if (result != null) return result; for (Map.Entry<String, E> entry : super.entrySet()) if (NullSafeComparator.equals(entry.getKey(), key)) return super.remove(entry.getKey()); return null; }
/** * writes the current file field content to the property. */ void update() { if (!locked) { locked = true; File file = getFile(); if (!NullSafeComparator.equals(file, BeanUtil.getPropertyValue(bean, propertyName))) BeanUtil.setPropertyValue(bean, propertyName, file); locked = false; } }
public boolean isTolerated(DiffDetailType diffType, String locator) { for (PathSetting pathSetting : pathSettings) { if (NullSafeComparator.equals(locator, pathSetting.getLocator()) && (pathSetting.getDiffType() == null || pathSetting.getDiffType() == diffType)) return true; } return false; }
/** * writes the current text field content to the property. */ void update() { if (!locked) { locked = true; Boolean propertyValue = (Boolean) BeanUtil.getPropertyValue(bean, propertyName); Boolean selected = isSelected(); if (!NullSafeComparator.equals(selected, propertyValue)) BeanUtil.setPropertyValue(bean, propertyName, selected); locked = false; } }
private void compareElementNames(Element expected, Element actual, String parentPathOfExpected, String parentPathOfActual, AggregateDiff diffs) { // assert equal node names String elementName = expected.getLocalName(); expectEqualStrings(elementName, actual.getLocalName(), ELEMENT_NAME, parentPathOfExpected, parentPathOfActual, diffs); if (settings.isNamespaceRelevant()) { String expectedNs = StringUtil.emptyToNull(expected.getNamespaceURI()); String actualNs = StringUtil.emptyToNull(actual.getNamespaceURI()); if (!NullSafeComparator.equals(expectedNs, actualNs)) diffs.addDetail(diffFactory.different(nsDescription(expectedNs), nsDescription(actualNs), ELEMENT_NAMESPACE, parentPathOfExpected, parentPathOfActual)); } }
private String formatDifferent() { if (NullSafeComparator.equals(locatorOfExpected, locatorOfActual)) return "Different " + objectClassifier + ": expected " + formatObject(expected) + " but found " + formatObject(actual) + (locatorOfActual != null ? " at " + locatorOfActual : ""); else return "Different " + objectClassifier + ": expected " + formatObject(expected) + (locatorOfExpected != null ? " at " + locatorOfExpected : "") + " but found " + formatObject(actual) + (locatorOfActual != null ? " at " + locatorOfActual : ""); }