Class TypeQueries
java.lang.Object
net.ssehub.easy.varModel.model.datatypes.TypeQueries
Provides some utility operations, also due to the split in the inheritance
hierarchy.
- Author:
- Holger Eichelberger
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic IDatatypefindDeepestGeneric(IDatatype type, int pos) Finds the deepest generic type intypealways tryingposas position for the generic type.static OperationgetOperation(IDatatype operand, String name, IDatatype... parameter) Returns an operation defined onoperandwith givennameandparameters.static booleanReturns 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 booleanReturns whethertypeis an enum.static booleanReturns whethertypeis a freeze variable.static booleanisReference(IDatatype type) Returns whethertypeis a reference.static booleanisSequence(IDatatype type) Returns whethertypeis a sequence.static booleanReturns whethertypeis a set.static IDatatyperesolveFully(IDatatype type) Resolves to the most basic type, i.e., even across nested references/derived types.static booleanReturns whether the two types given are the same.static IDatatype[]toGenerics(IDatatype type) Turns the generics oftypeinto an array of types.
-
Constructor Details
-
TypeQueries
public TypeQueries()
-
-
Method Details
-
getOperation
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
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
Returns whethertypeisAnyType.- Parameters:
type- the type to check- Returns:
trueforAnyType,falseelse
-
isEnum
Returns whethertypeis an enum.- Parameters:
type- the type to check- Returns:
trueiftypeis an enum,falseelse
-
isFreezeVariableType
Returns whethertypeis a freeze variable.- Parameters:
type- the type to check- Returns:
trueiftypeis a a freeze variable,falseelse
-
isReference
Returns whethertypeis a reference.- Parameters:
type- the type to check- Returns:
trueiftypeis a reference,falseelse
-
isConstraint
Returns whethertypeis a constraint (in the sense of a constraint variable).- Parameters:
type- the type to check- Returns:
trueiftypeis a constraint,falseelse
-
isCompound
Returns whethertypeis a compound type.- Parameters:
type- the type- Returns:
truefor compound,falseelse
-
isContainer
Returns whethertypeis a container.- Parameters:
type- the type to check for- Returns:
trueiftypeis a container,falseelse
-
isSet
Returns whethertypeis a set.- Parameters:
type- the type to check for- Returns:
trueiftypeis a container,falseelse
-
isSequence
Returns whethertypeis a sequence.- Parameters:
type- the type to check for- Returns:
trueiftypeis a container,falseelse
-
findDeepestGeneric
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
Turns the generics oftypeinto an array of types.- Parameters:
type- the type- Returns:
- the generics
-
resolveFully
Resolves to the most basic type, i.e., even across nested references/derived types.- Parameters:
type- the type to resolve- Returns:
- the most basic type
-