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 NameComparator() { this.nameComparator = new NullSafeComparator<String>(Collator.getInstance()); }
public boolean contains(E element) { for (int i = 0; i < elementCount; i++) if (NullSafeComparator.equals(buffer[i], element)) return true; return false; }
public static <T> Comparator<T> getComparator(Class<T> type) { Comparator<T> comparator = (Comparator<T>) comparators.get(type); if (comparator == null && Comparable.class.isAssignableFrom(type)) comparator = new ComparableComparator(); if (comparator == null) throw new RuntimeException("No Comparator defined for " + type.getName()); return new NullSafeComparator<T>(comparator); } }
@Override public boolean evaluate(E argument) { return NullSafeComparator.equals(argument, reference); }
/** * ignores description */ @Override public boolean isIdentical(DBObject object) { if (!(object instanceof DBTrigger)) return false; DBTrigger that = (DBTrigger) object; return NullSafeComparator.equals(this.triggerType, that.triggerType) && NullSafeComparator.equals(this.triggeringEvent, that.triggeringEvent) && NullSafeComparator.equals(this.baseObjectType, that.baseObjectType) && NullSafeComparator.equals(this.tableName, that.tableName) && NullSafeComparator.equals(this.columnName, that.columnName) && NullSafeComparator.equals(this.referencingNames, that.referencingNames) && NullSafeComparator.equals(this.whenClause, that.whenClause) && NullSafeComparator.equals(this.status, that.status) && NullSafeComparator.equals(this.actionType, that.actionType) && NullSafeComparator.equals(this.triggerBody.trim(), that.triggerBody.trim()); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null || getClass() != obj.getClass()) return false; DiffDetail that = (DiffDetail) obj; return (NullSafeComparator.equals(this.expected, that.expected) && NullSafeComparator.equals(this.actual, that.actual) && NullSafeComparator.equals(this.type, that.type) && NullSafeComparator.equals(this.locatorOfExpected, that.locatorOfExpected) && NullSafeComparator.equals(this.locatorOfActual, that.locatorOfActual)); }
@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); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null || getClass() != obj.getClass()) return false; TreeBuilder that = (TreeBuilder) obj; return (NullSafeComparator.equals(this.rootName, that.rootName) && NullSafeComparator.equals(this.rootMap, that.rootMap)); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null || getClass() != obj.getClass()) return false; KeyExpression that = (KeyExpression) obj; return NullSafeComparator.equals(this.expression, that.expression) && NullSafeComparator.equals(this.locator, that.locator); }
@Override public boolean equals(Object other) { if (this == other) return true; if (other == null || getClass() != other.getClass()) return false; @SuppressWarnings("rawtypes") Interval that = (Interval) other; return (NullSafeComparator.equals(this.min, that.min) && this.minInclusive == that.minInclusive && NullSafeComparator.equals(this.max, that.max) && this.maxInclusive == that.maxInclusive); }
@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; }
/** * Tells if an array contains a specific element * @param element the element to search * @param array the array to scan * @return true if the element was found, else false */ public static boolean contains(Object element, Object array) { int length = Array.getLength(array); for (int i = 0; i < length; i++) { Object o = Array.get(array, i); if (NullSafeComparator.equals(o, element)) return true; } return false; }
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; }