ua.gradsoft.javachecker.models
Class JavaTypeModelHelper

java.lang.Object
  extended by ua.gradsoft.javachecker.models.JavaTypeModelHelper

public class JavaTypeModelHelper
extends java.lang.Object

Helper for operations under types.

Author:
Ruslan Shevchenko

Constructor Summary
JavaTypeModelHelper()
           
 
Method Summary
static JavaTypeModel boxingConversion(JavaTypeModel x, MethodMatchingConversions c)
          primitive type -> appropriative Object
static Term createModelTermList(java.util.List<JavaTypeModel> l)
           
static boolean isBoolean(JavaTypeModel x)
           
static boolean isByte(JavaTypeModel x)
           
static boolean isChar(JavaTypeModel x)
           
static boolean isDouble(JavaTypeModel x)
           
static boolean isFloat(JavaTypeModel x)
           
static boolean isInt(JavaTypeModel x)
           
static boolean isLong(JavaTypeModel x)
           
static boolean isShort(JavaTypeModel x)
           
static JavaTypeModel minmax(JavaTypeModel x, JavaTypeModel y, MethodMatchingConversions cn, boolean debug)
          find minimal maximum from x and y
static boolean same(JavaTypeModel x, JavaTypeModel y)
           
static boolean same(JavaTypeModel x, JavaTypeModel y, boolean debug)
           
static boolean sameNames(JavaTypeModel x, JavaTypeModel y)
           
static boolean subtypeOrSame(JavaTypeModel t, JavaTypeModel s)
           
static boolean subtypeOrSame(JavaTypeModel t, JavaTypeModel s, MethodMatchingConversions conversions, boolean freeTypeArguments, boolean debug)
          define subtyping.
static boolean subtypeOrSamePrimitive(java.lang.String tn, java.lang.String sn)
           
static JavaTypeModel unboxingConversion(JavaTypeModel x, MethodMatchingConversions c)
          Object -> appropriate primitive
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaTypeModelHelper

public JavaTypeModelHelper()
Method Detail

subtypeOrSame

public static boolean subtypeOrSame(JavaTypeModel t,
                                    JavaTypeModel s)
                             throws TermWareException,
                                    EntityNotFoundException
Throws:
TermWareException
EntityNotFoundException

subtypeOrSame

public static boolean subtypeOrSame(JavaTypeModel t,
                                    JavaTypeModel s,
                                    MethodMatchingConversions conversions,
                                    boolean freeTypeArguments,
                                    boolean debug)
                             throws TermWareException
define subtyping. See section 4.10 of Java Language Specification fill necessor matching conversion if needed.

Parameters:
t - first typeModel to check
s - second typemodel to check
conversions - - matching conversions, necessory for matching
freeTypeArguments - - when true, match type argument with any type and add matching to substitution
debug - -- provide additional logging when true
Returns:
true if s is supertype of t ( t < s)
Throws:
TermWareException

same

public static boolean same(JavaTypeModel x,
                           JavaTypeModel y)
                    throws TermWareException
Throws:
TermWareException

same

public static boolean same(JavaTypeModel x,
                           JavaTypeModel y,
                           boolean debug)
                    throws TermWareException
Throws:
TermWareException

subtypeOrSamePrimitive

public static boolean subtypeOrSamePrimitive(java.lang.String tn,
                                             java.lang.String sn)

minmax

public static JavaTypeModel minmax(JavaTypeModel x,
                                   JavaTypeModel y,
                                   MethodMatchingConversions cn,
                                   boolean debug)
                            throws TermWareException,
                                   EntityNotFoundException
find minimal maximum from x and y

Throws:
TermWareException
EntityNotFoundException

isBoolean

public static boolean isBoolean(JavaTypeModel x)

isByte

public static boolean isByte(JavaTypeModel x)

isShort

public static boolean isShort(JavaTypeModel x)

isInt

public static boolean isInt(JavaTypeModel x)

isLong

public static boolean isLong(JavaTypeModel x)

isFloat

public static boolean isFloat(JavaTypeModel x)

isDouble

public static boolean isDouble(JavaTypeModel x)

isChar

public static boolean isChar(JavaTypeModel x)

unboxingConversion

public static JavaTypeModel unboxingConversion(JavaTypeModel x,
                                               MethodMatchingConversions c)
Object -> appropriate primitive


boxingConversion

public static JavaTypeModel boxingConversion(JavaTypeModel x,
                                             MethodMatchingConversions c)
primitive type -> appropriative Object


sameNames

public static boolean sameNames(JavaTypeModel x,
                                JavaTypeModel y)
                         throws TermWareException
Throws:
TermWareException

createModelTermList

public static Term createModelTermList(java.util.List<JavaTypeModel> l)
                                throws TermWareException,
                                       EntityNotFoundException
Throws:
TermWareException
EntityNotFoundException