private AttributeType getCommonType ( AttributeType existingGuess , AttributeType newGuess ) { if ( existingGuess == null && newGuess == null ) { return null ; } if ( existingGuess == null ) { return newGuess ; } if ( newGuess == null ) { return existingGuess ; } if ( existingGuess . equals ( newGuess ) ) { return existingGuess ; } switch ( existingGuess ) { case INT : //noinspection Duplicates if ( newGuess . equals ( DECIMAL ) ) { return DECIMAL ; } else if ( newGuess . equals ( LONG ) ) { return LONG ; } else { return STRING ; } case DECIMAL : if ( newGuess . equals ( INT ) || newGuess . equals ( LONG ) ) { return DECIMAL ; } else { return STRING ; } case LONG : //noinspection Duplicates if ( newGuess . equals ( INT ) ) { return LONG ; } else if ( newGuess . equals ( DECIMAL ) ) { return DECIMAL ; } else { return STRING ; } default : return STRING ; } }
Returns the AttributeType shared by both types