@Test public void testEqualsStrict() { assertEqualsStrict((Serializable) null, (Serializable) null); assertNotEqualsStrict((Serializable) null, "foo"); assertEqualsStrict("foo", "foo"); assertNotEqualsStrict("foo", "bar"); assertEqualsStrict(Long.valueOf(123456), Long.valueOf(123456)); assertNotEqualsStrict(Long.valueOf(123456), Long.valueOf(789123)); assertNotEqualsStrict("foo", Long.valueOf(123456)); assertNotEqualsStrict("foo", new State()); assertNotEqualsStrict("foo", new ArrayList<Serializable>()); assertNotEqualsStrict(new State(), new ArrayList<Serializable>()); assertEqualsStrict(new String[0], new String[0]); assertEqualsStrict(new String[] { "foo" }, new String[] { "foo" }); assertNotEqualsStrict(new String[] { "foo" }, new String[] { "bar" }); State a = new State(); State b = new State(); assertEqualsStrict(a, b); a.put("foo", "bar"); assertNotEqualsStrict(a, b); b.put("foo", "bar"); assertEqualsStrict(a, b); b.put("foo", "moo"); assertNotEqualsStrict(a, b); a.put("foo", new State()); b.put("foo", new State()); assertEqualsStrict(a, b); ArrayList<Serializable> la = new ArrayList<>(); ArrayList<Serializable> lb = new ArrayList<>(); assertEqualsStrict(la, lb); la.add(new State()); assertNotEqualsStrict(la, lb); lb.add(new State()); assertEqualsStrict(la, lb); ((State) la.get(0)).put("foo", "bar"); assertNotEqualsStrict(la, lb); ((State) lb.get(0)).put("foo", "bar"); assertEqualsStrict(la, lb); ((State) lb.get(0)).put("foo", "moo"); assertNotEqualsStrict(la, lb); }
public static boolean equalsStrict(Object a, Object b) { if (a == b) { return true; } else if (a == null || b == null) { return false; } else if (a instanceof State && b instanceof State) { return equalsStrict((State) a, (State) b); } else if (a instanceof List && b instanceof List) { @SuppressWarnings("unchecked") List<Serializable> la = (List<Serializable>) a; @SuppressWarnings("unchecked") List<Serializable> lb = (List<Serializable>) b; return equalsStrict(la, lb); } else if (a instanceof Object[] && b instanceof Object[]) { return equalsStrict((Object[]) a, (Object[]) b); } else if (a instanceof ListDiff && b instanceof ListDiff) { ListDiff lda = (ListDiff) a; ListDiff ldb = (ListDiff) b; return lda.isArray == ldb.isArray && equalsStrict(lda.diff, ldb.diff) && equalsStrict(lda.rpush, ldb.rpush); } else if (isScalar(a) && isScalar(b)) { return a.equals(b); } else { return false; } }
StateHelper { public static boolean equalsStrict(Object a, Object b) { if (a == b) { return true; } else if (a == null || b == null) { return false; } else if (a instanceof State && b instanceof State) { return equalsStrict((State) a, (State) b); } else if (a instanceof List && b instanceof List) { @SuppressWarnings("unchecked") List<Serializable> la = (List<Serializable>) a; @SuppressWarnings("unchecked") List<Serializable> lb = (List<Serializable>) b; return equalsStrict(la, lb); } else if (a instanceof Object[] && b instanceof Object[]) { return equalsStrict((Object[]) a, (Object[]) b); } else if (a instanceof ListDiff && b instanceof ListDiff) { ListDiff lda = (ListDiff) a; ListDiff ldb = (ListDiff) b; return lda.isArray == ldb.isArray && equalsStrict(lda.diff, ldb.diff) && equalsStrict(lda.rpush, ldb.rpush); } else if (isScalar(a) && isScalar(b)) { return a.equals(b); } else { return false; } } }
StateHelper { public static boolean equalsStrict(Object a, Object b) { if (a == b) { return true; } else if (a == null || b == null) { return false; } else if (a instanceof State && b instanceof State) { return equalsStrict((State) a, (State) b); } else if (a instanceof List && b instanceof List) { @SuppressWarnings("unchecked") List<Serializable> la = (List<Serializable>) a; @SuppressWarnings("unchecked") List<Serializable> lb = (List<Serializable>) b; return equalsStrict(la, lb); } else if (a instanceof Object[] && b instanceof Object[]) { return equalsStrict((Object[]) a, (Object[]) b); } else if (a instanceof ListDiff && b instanceof ListDiff) { ListDiff lda = (ListDiff) a; ListDiff ldb = (ListDiff) b; return lda.isArray == ldb.isArray && equalsStrict(lda.diff, ldb.diff) && equalsStrict(lda.rpush, ldb.rpush); } else if (isScalar(a) && isScalar(b)) { return a.equals(b); } else { return false; } } private  StateHelper(); }
StateHelper { public static boolean equalsStrict(Object a, Object b) { if (a == b) { return true; } else if (a == null || b == null) { return false; } else if (a instanceof State && b instanceof State) { return equalsStrict((State) a, (State) b); } else if (a instanceof List && b instanceof List) { @SuppressWarnings("unchecked") List<Serializable> la = (List<Serializable>) a; @SuppressWarnings("unchecked") List<Serializable> lb = (List<Serializable>) b; return equalsStrict(la, lb); } else if (a instanceof Object[] && b instanceof Object[]) { return equalsStrict((Object[]) a, (Object[]) b); } else if (a instanceof ListDiff && b instanceof ListDiff) { ListDiff lda = (ListDiff) a; ListDiff ldb = (ListDiff) b; return lda.isArray == ldb.isArray && equalsStrict(lda.diff, ldb.diff) && equalsStrict(lda.rpush, ldb.rpush); } else if (isScalar(a) && isScalar(b)) { return a.equals(b); } else { return false; } } private  StateHelper(); static boolean isScalar(Object value); static boolean equalsStrict(Object a, Object b); static boolean equalsStrict(State a, State b); static boolean equalsStrict(Object[] a, Object[] b); static boolean equalsStrict(List<Serializable> a, List<Serializable> b); static boolean equalsLoose(Object a, Object b); static boolean equalsLoose(State a, State b); static boolean equalsLoose(Object[] a, Object[] b); static boolean equalsLoose(List<Serializable> a, List<Serializable> b); static Serializable deepCopy(Object value); static Serializable deepCopy(Object value, boolean threadSafe); static State deepCopy(State state); static State deepCopy(State state, boolean threadSafe); static List<Serializable> deepCopy(List<Serializable> list); static List<Serializable> deepCopy(List<Serializable> list, boolean threadSafe); static Serializable diff(Object a, Object b); static Serializable diff(Object[] a, Object[] b); static Serializable diff(List<Object> a, List<Object> b); static StateDiff diff(State a, State b); static void resetDeltas(State state); }
StateHelper { public static boolean equalsStrict(Object a, Object b) { if (a == b) { return true; } else if (a == null || b == null) { return false; } else if (a instanceof State && b instanceof State) { return equalsStrict((State) a, (State) b); } else if (a instanceof List && b instanceof List) { @SuppressWarnings("unchecked") List<Serializable> la = (List<Serializable>) a; @SuppressWarnings("unchecked") List<Serializable> lb = (List<Serializable>) b; return equalsStrict(la, lb); } else if (a instanceof Object[] && b instanceof Object[]) { return equalsStrict((Object[]) a, (Object[]) b); } else if (a instanceof ListDiff && b instanceof ListDiff) { ListDiff lda = (ListDiff) a; ListDiff ldb = (ListDiff) b; return lda.isArray == ldb.isArray && equalsStrict(lda.diff, ldb.diff) && equalsStrict(lda.rpush, ldb.rpush); } else if (isScalar(a) && isScalar(b)) { return a.equals(b); } else { return false; } } private  StateHelper(); static boolean isScalar(Object value); static boolean equalsStrict(Object a, Object b); static boolean equalsStrict(State a, State b); static boolean equalsStrict(Object[] a, Object[] b); static boolean equalsStrict(List<Serializable> a, List<Serializable> b); static boolean equalsLoose(Object a, Object b); static boolean equalsLoose(State a, State b); static boolean equalsLoose(Object[] a, Object[] b); static boolean equalsLoose(List<Serializable> a, List<Serializable> b); static Serializable deepCopy(Object value); static Serializable deepCopy(Object value, boolean threadSafe); static State deepCopy(State state); static State deepCopy(State state, boolean threadSafe); static List<Serializable> deepCopy(List<Serializable> list); static List<Serializable> deepCopy(List<Serializable> list, boolean threadSafe); static Serializable diff(Object a, Object b); static Serializable diff(Object[] a, Object[] b); static Serializable diff(List<Object> a, List<Object> b); static StateDiff diff(State a, State b); static void resetDeltas(State state);  }