private boolean rowIsExactMatch(HollowDiffViewRow row) { EffigyFieldPair fieldPair = row.getFieldPair(); if(fieldPair.getFrom() == null || fieldPair.getTo() == null || fieldPair.isLeafNode()) return false; HollowEffigy fromEffigy = (HollowEffigy)fieldPair.getFrom().getValue(); HollowEffigy toEffigy = (HollowEffigy)fieldPair.getTo().getValue(); if(fromEffigy == null || toEffigy == null) return false; return exactRecordMatcher.isExactMatch(fromEffigy.getDataAccess(), fromEffigy.getOrdinal(), toEffigy.getDataAccess(), toEffigy.getOrdinal()); }
private int fieldHashCode(HollowEffigy element, int[] fieldPath) { HollowObjectTypeDataAccess dataAccess = (HollowObjectTypeDataAccess) element.getDataAccess(); HollowObjectSchema schema = dataAccess.getSchema(); int ordinal = element.getOrdinal(); for (int i = 0; i < fieldPath.length - 1; i++) { int fieldPosition = fieldPath[i]; ordinal = dataAccess.readOrdinal(ordinal, fieldPosition); dataAccess = (HollowObjectTypeDataAccess) dataAccess.getDataAccess().getTypeDataAccess(schema.getReferencedType(fieldPosition)); schema = dataAccess.getSchema(); } int fieldHash = HollowReadFieldUtils.fieldHashCode(dataAccess, ordinal, fieldPath[fieldPath.length-1]); return HashCodes.hashInt(fieldHash); }
private boolean fieldsAreEqual(HollowEffigy fromElement, HollowEffigy toElement, int[] fromFieldPath, int[] toFieldPath) { HollowObjectTypeDataAccess fromDataAccess = (HollowObjectTypeDataAccess) fromElement.getDataAccess(); int fromOrdinal = fromElement.getOrdinal(); HollowObjectTypeDataAccess toDataAccess = (HollowObjectTypeDataAccess) toElement.getDataAccess(); int toOrdinal = toElement.getOrdinal(); HollowObjectSchema fromSchema = fromDataAccess.getSchema(); HollowObjectSchema toSchema = toDataAccess.getSchema(); for (int i = 0; i < fromFieldPath.length - 1; i++) { int fromFieldPosition = fromFieldPath[i]; int toFieldPosition = toFieldPath[i]; fromOrdinal = fromDataAccess.readOrdinal(fromOrdinal, fromFieldPosition); toOrdinal = toDataAccess.readOrdinal(toOrdinal, toFieldPosition); fromDataAccess = (HollowObjectTypeDataAccess) fromDataAccess.getDataAccess().getTypeDataAccess(fromSchema.getReferencedType(fromFieldPosition)); toDataAccess = (HollowObjectTypeDataAccess) toDataAccess.getDataAccess().getTypeDataAccess(toSchema.getReferencedType(toFieldPosition)); fromSchema = fromDataAccess.getSchema(); toSchema = toDataAccess.getSchema(); } return HollowReadFieldUtils.fieldsAreEqual(fromDataAccess, fromOrdinal, fromFieldPath[fromFieldPath.length-1], toDataAccess, toOrdinal, toFieldPath[toFieldPath.length-1]); }