当前位置: 首页>>代码示例>>Java>>正文


Java IDatatype.getGenericTypeCount方法代码示例

本文整理汇总了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;
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:25,代码来源:AbstractIvmlVariable.java

示例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;
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:24,代码来源:OCLFeatureCall.java

示例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;
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:21,代码来源:TypeRegistry.java

示例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;
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:11,代码来源:ContainerValue.java

示例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));
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:12,代码来源:ReasoningUtils.java


注:本文中的net.ssehub.easy.varModel.model.datatypes.IDatatype.getGenericTypeCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。