/** * Given this type and another, find the 'broadest' type * * @param rhs The other type. * @return The broadest type * @throws TypeMismatchException Data does not match expected data type. */ public DataType getCommnType(DataType rhs) throws TypeMismatchException { final DataType result; result = ordinal() > rhs.ordinal() ? this : rhs; if (numeric || rhs.numeric) { // One numeric then both must be.. if (result.ordinal() > F.ordinal()) { throw new TypeMismatchException("Either both must be numeric or neither"); } } else { // Neither numeric then both must be the same if (ordinal() != rhs.ordinal()) { throw new TypeMismatchException("Both types must be the same for non-numerics"); } } return result; }