本文整理汇总了Java中net.ssehub.easy.varModel.model.datatypes.IDatatype.getGenericTypeCount方法的典型用法代码示例。如果您正苦于以下问题:Java IDatatype.getGenericTypeCount方法的具体用法?Java IDatatype.getGenericTypeCount怎么用?Java IDatatype.getGenericTypeCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.ssehub.easy.varModel.model.datatypes.IDatatype
的用法示例。
在下文中一共展示了IDatatype.getGenericTypeCount方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addValue
import net.ssehub.easy.varModel.model.datatypes.IDatatype; //导入方法依赖的package包/类
/**
* Adds a value if the actual variable represents an IVML collection.
*
* @param type the desired type of the new variable (must be compatible to the element type of the
* underlying collection)
* @return the added variable
*/
public DecisionVariable addValue(TypeDescriptor<?> type) {
DecisionVariable result = null;
if (null != variable && type instanceof IvmlTypeDescriptor) {
IDatatype vType = DerivedDatatype.resolveToBasis(variable.getDeclaration().getType());
if (Container.TYPE.isAssignableFrom(vType) && vType.getGenericTypeCount() > 0) {
IDatatype iType = ((IvmlTypeDescriptor) type).getIvmlType();
if (vType.getGenericType(0).isAssignableFrom(iType)) {
result = addValue(iType);
} else {
getLogger().warn("given type is not compatible to container element type");
}
} else {
getLogger().warn("given type is not a container");
}
}
return result;
}
示例2: checkOperand
import net.ssehub.easy.varModel.model.datatypes.IDatatype; //导入方法依赖的package包/类
/**
* If required, checks the operand against the operation result type.
*
* @param op the operation
* @param operandType the operand type
* @param paramTypes the parameter types
* @return <code>op</code> or <b>null</b> if <code>op</code> is not valid with respect to its operand
*/
private Operation checkOperand(Operation op, IDatatype operandType, IDatatype[] paramTypes) {
Operation result = op;
if (null != op) {
ReturnTypeMode mode = op.getReturnTypeMode();
if (ReturnTypeMode.PARAM_1_CHECK == mode) {
if (Container.TYPE.isAssignableFrom(operandType) && 1 == operandType.getGenericTypeCount()) {
if (!operandType.getGenericType(0).isAssignableFrom(
getActualReturnType(op, operandType, paramTypes))) {
result = null;
}
}
}
}
return result;
}
示例3: resolveGenerics
import net.ssehub.easy.varModel.model.datatypes.IDatatype; //导入方法依赖的package包/类
/**
* Resolves IVML type generics.
*
* @param type the type to resolve the generics fro
* @return the generics, <b>null</b> if there are no generics or the generics are not resolvable
* @see #getType(IDatatype)
*/
public TypeDescriptor<?>[] resolveGenerics(IDatatype type) {
TypeDescriptor<?>[] result = null;
if (type.getGenericTypeCount() > 0) {
result = TypeDescriptor.createArray(type.getGenericTypeCount());
for (int g = 0; null != result && g < type.getGenericTypeCount(); g++) {
result[g] = getType(type.getGenericType(g));
if (null == result[g]) {
result = null;
}
}
}
return result;
}
示例4: getContainedType
import net.ssehub.easy.varModel.model.datatypes.IDatatype; //导入方法依赖的package包/类
@Override
public IDatatype getContainedType() {
IDatatype type = getType();
if (1 == type.getGenericTypeCount()) {
type = type.getGenericType(0);
} else {
type = null;
}
return type;
}
示例5: isNestedContainer
import net.ssehub.easy.varModel.model.datatypes.IDatatype; //导入方法依赖的package包/类
/**
* Returns whether <code>type</code> is a type-nested container.
*
* @param type the type
* @return <code>true</code> for a nested collection, <code>false else</code>
*/
static boolean isNestedContainer(IDatatype type) {
return TypeQueries.isContainer(type)
&& 1 == type.getGenericTypeCount()
&& isNestedContainer(type.getGenericType(0));
}