1 package com.stateofflow.eclipse.metrics.bindings;
2
3 import org.eclipse.core.runtime.Assert;
4 import org.eclipse.jdt.core.dom.IBinding;
5
6 public class Equality {
7 public static boolean equals(final IBinding[] b1, final IBinding[] b2) {
8 Assert.isNotNull(b1);
9 return b1 == b2 || b2 != null && b1.length == b2.length && elementsEqual(b1, b2);
10 }
11
12 private static boolean elementsEqual(final IBinding[] b1, final IBinding[] b2) {
13 for (int i = 0; i < b1.length; i++) {
14 if (!equals(b1[i], b2[i])) {
15 return false;
16 }
17 }
18 return true;
19 }
20
21 public static boolean equals(final IBinding b1, final IBinding b2) {
22 return b1.isEqualTo(b2);
23 }
24 }
25