org.objectweb.medor.expression.type

Class ExpressionTypeHelper


public class ExpressionTypeHelper
extends java.lang.Object

Author:
A. Lefebvre

Method Summary

static PType
getResultType(PType type1, PType type2)
This method returns the type which would result from applying a binary operator to 2 objects of given PType.
static boolean
isArithmeticType(PType t)
This method tells if a given Type is an arithmetic type

Method Details

getResultType

public static PType getResultType(PType type1,
                                  PType type2)
            throws TypingException
This method returns the type which would result from applying a binary operator to 2 objects of given PType. If the two PTypes are incompatible, a TypingException is thrown.

Parameters:
type1 - The PType of the first object.
type2 - The PType of the second object.

Returns:
The PType of the result.


isArithmeticType

public static final boolean isArithmeticType(PType t)
This method tells if a given Type is an arithmetic type

Parameters:
t - The PType to be checked.

Returns:
true if the tested PType is an arithmetic type.