public static boolean fieldsAreEqual ( HollowObjectTypeDataAccess typeAccess1 , int ordinal1 , int fieldPosition1 , HollowObjectTypeDataAccess typeAccess2 , int ordinal2 , int fieldPosition2 ) { HollowObjectSchema schema1 = typeAccess1 . getSchema ( ) ; switch ( schema1 . getFieldType ( fieldPosition1 ) ) { case BOOLEAN : Boolean bool1 = typeAccess1 . readBoolean ( ordinal1 , fieldPosition1 ) ; Boolean bool2 = typeAccess2 . readBoolean ( ordinal2 , fieldPosition2 ) ; return bool1 == bool2 ; case BYTES : byte [ ] data1 = typeAccess1 . readBytes ( ordinal1 , fieldPosition1 ) ; byte [ ] data2 = typeAccess2 . readBytes ( ordinal2 , fieldPosition2 ) ; return Arrays . equals ( data1 , data2 ) ; case DOUBLE : double d1 = typeAccess1 . readDouble ( ordinal1 , fieldPosition1 ) ; double d2 = typeAccess2 . readDouble ( ordinal2 , fieldPosition2 ) ; return Double . compare ( d1 , d2 ) == 0 ; case FLOAT : float f1 = typeAccess1 . readFloat ( ordinal1 , fieldPosition1 ) ; float f2 = typeAccess2 . readFloat ( ordinal2 , fieldPosition2 ) ; return Float . compare ( f1 , f2 ) == 0 ; case INT : int i1 = typeAccess1 . readInt ( ordinal1 , fieldPosition1 ) ; int i2 = typeAccess2 . readInt ( ordinal2 , fieldPosition2 ) ; return i1 == i2 ; case LONG : long l1 = typeAccess1 . readLong ( ordinal1 , fieldPosition1 ) ; long l2 = typeAccess2 . readLong ( ordinal2 , fieldPosition2 ) ; return l1 == l2 ; case STRING : String s1 = typeAccess1 . readString ( ordinal1 , fieldPosition1 ) ; return typeAccess2 . isStringFieldEqual ( ordinal2 , fieldPosition2 , s1 ) ; case REFERENCE : if ( typeAccess1 == typeAccess2 && fieldPosition1 == fieldPosition2 ) return typeAccess1 . readOrdinal ( ordinal1 , fieldPosition1 ) == typeAccess2 . readOrdinal ( ordinal2 , fieldPosition2 ) ; default : } throw new IllegalStateException ( "I don't know how to test equality for a " + schema1 . getFieldType ( fieldPosition1 ) ) ; }
Determine whether two OBJECT field records are exactly equal .