use of org.yakindu.base.types.Type in project statecharts by Yakindu.
the class StextTestFactory method _createRealType.
public static Type _createRealType(String name) {
Type t = TypesFactory.eINSTANCE.createPrimitiveType();
t.setName(name);
return t;
}
use of org.yakindu.base.types.Type in project statecharts by Yakindu.
the class StextTestFactory method _createIntegerType.
public static Type _createIntegerType(String name) {
Type t = TypesFactory.eINSTANCE.createPrimitiveType();
t.setName(name);
return t;
}
use of org.yakindu.base.types.Type in project statecharts by Yakindu.
the class AbstractTypeSystem method isSuperType.
/**
* @returns <code>true</code> if superType is a direct or indirect super type of
* subType.
*/
@Override
public boolean isSuperType(Type subtype, Type supertype) {
Set<Type> typehierachy = new LinkedHashSet<Type>();
typehierachy.add(subtype);
collectSupertypes(subtype, typehierachy);
for (Type eObject : typehierachy) {
if (isSame(eObject, supertype))
return true;
}
return false;
}
use of org.yakindu.base.types.Type in project statecharts by Yakindu.
the class AbstractTypeSystem method getDirectSuperTypes.
/**
* Returns the list of direct super types for given type. Also reflects
* primitive type's base types, type parameter bounds and complex type's super
* types.
*/
protected List<Type> getDirectSuperTypes(Type type) {
List<Type> superTypes = new ArrayList<Type>();
for (Entry<Type, Type> entry : extendsRegistry.entries()) {
if (isSame(type, entry.getKey())) {
superTypes.add(entry.getValue());
}
}
superTypes.addAll(type.getSuperTypes());
if (type instanceof TypeParameter) {
TypeParameter typeParameter = (TypeParameter) type;
Type bound = typeParameter.getBound();
if (bound != null) {
superTypes.add(bound);
}
}
return superTypes;
}
use of org.yakindu.base.types.Type in project statecharts by Yakindu.
the class AbstractTypeSystem method getCommonTypeWithConversion.
@Override
public Type getCommonTypeWithConversion(Type type1, Type type2) {
Type result = getCommonType(type1, type2);
if (result != null)
return result;
Type conversionType1 = getConversionType(type1);
if (conversionType1 != null) {
result = getCommonTypeInternal(conversionType1, type2);
if (result != null)
return result;
}
Type conversionType2 = getConversionType(type2);
if (conversionType2 != null)
return getCommonTypeInternal(type1, conversionType2);
return null;
}
Aggregations