Class TypeQueries
- java.lang.Object
-
- net.ssehub.easy.varModel.model.datatypes.TypeQueries
-
public class TypeQueries extends java.lang.ObjectProvides some utility operations, also due to the split in the inheritance hierarchy.- Author:
- Holger Eichelberger
-
-
Constructor Summary
Constructors Constructor Description TypeQueries()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static IDatatypefindDeepestGeneric(IDatatype type, int pos)Finds the deepest generic type intypealways tryingposas position for the generic type.static OperationgetOperation(IDatatype operand, java.lang.String name, IDatatype... parameter)Returns an operation defined onoperandwith givennameandparameters.static booleanisAnyType(IDatatype type)Returns whethertypeisAnyType.static booleanisCompound(IDatatype type)Returns whethertypeis a compound type.static booleanisConstraint(IDatatype type)Returns whethertypeis a constraint (in the sense of a constraint variable).static booleanisContainer(IDatatype type)Returns whethertypeis a container.static booleanisEnum(IDatatype type)Returns whethertypeis an enum.static booleanisFreezeVariableType(IDatatype type)Returns whethertypeis a freeze variable.static booleanisReference(IDatatype type)Returns whethertypeis a reference.static booleanisSequence(IDatatype type)Returns whethertypeis a sequence.static booleanisSet(IDatatype type)Returns whethertypeis a set.static IDatatyperesolveFully(IDatatype type)Resolves to the most basic type, i.e., even across nested references/derived types.static booleansameTypes(IDatatype type1, IDatatype type2)Returns whether the two types given are the same.static IDatatype[]toGenerics(IDatatype type)Turns the generics oftypeinto an array of types.
-
-
-
Method Detail
-
getOperation
public static Operation getOperation(IDatatype operand, java.lang.String name, IDatatype... parameter)
Returns an operation defined onoperandwith givennameandparameters. Please note that the first parameter of an operation is implicitlyoperand.- Parameters:
operand- the type the operation shall be defined forname- the name of the operationparameter- the list of parameters (excluding this data type)- Returns:
- the operation or null if none was found
-
sameTypes
public static boolean sameTypes(IDatatype type1, IDatatype type2)
Returns whether the two types given are the same.- Parameters:
type1- the first typetype2- the second type- Returns:
trueif type1 and type2 are the same,falseelse
-
isAnyType
public static boolean isAnyType(IDatatype type)
Returns whethertypeisAnyType.- Parameters:
type- the type to check- Returns:
trueforAnyType,falseelse
-
isEnum
public static boolean isEnum(IDatatype type)
Returns whethertypeis an enum.- Parameters:
type- the type to check- Returns:
trueiftypeis an enum,falseelse
-
isFreezeVariableType
public static boolean isFreezeVariableType(IDatatype type)
Returns whethertypeis a freeze variable.- Parameters:
type- the type to check- Returns:
trueiftypeis a a freeze variable,falseelse
-
isReference
public static boolean isReference(IDatatype type)
Returns whethertypeis a reference.- Parameters:
type- the type to check- Returns:
trueiftypeis a reference,falseelse
-
isConstraint
public static boolean isConstraint(IDatatype type)
Returns whethertypeis a constraint (in the sense of a constraint variable).- Parameters:
type- the type to check- Returns:
trueiftypeis a constraint,falseelse
-
isCompound
public static boolean isCompound(IDatatype type)
Returns whethertypeis a compound type.- Parameters:
type- the type- Returns:
truefor compound,falseelse
-
isContainer
public static boolean isContainer(IDatatype type)
Returns whethertypeis a container.- Parameters:
type- the type to check for- Returns:
trueiftypeis a container,falseelse
-
isSet
public static boolean isSet(IDatatype type)
Returns whethertypeis a set.- Parameters:
type- the type to check for- Returns:
trueiftypeis a container,falseelse
-
isSequence
public static boolean isSequence(IDatatype type)
Returns whethertypeis a sequence.- Parameters:
type- the type to check for- Returns:
trueiftypeis a container,falseelse
-
findDeepestGeneric
public static IDatatype findDeepestGeneric(IDatatype type, int pos)
Finds the deepest generic type intypealways tryingposas position for the generic type.- Parameters:
type- the typepos- the 0-based position of the generic type to follow- Returns:
- the deepest generic type
-
toGenerics
public static IDatatype[] toGenerics(IDatatype type)
Turns the generics oftypeinto an array of types.- Parameters:
type- the type- Returns:
- the generics
-
-