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


Java IDatatype.getName方法代码示例

本文整理汇总了Java中net.ssehub.easy.varModel.model.datatypes.IDatatype.getName方法的典型用法代码示例。如果您正苦于以下问题:Java IDatatype.getName方法的具体用法?Java IDatatype.getName怎么用?Java IDatatype.getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.ssehub.easy.varModel.model.datatypes.IDatatype的用法示例。


在下文中一共展示了IDatatype.getName方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: visitFreezeBlock

import net.ssehub.easy.varModel.model.datatypes.IDatatype; //导入方法依赖的package包/类
@Override
public void visitFreezeBlock(FreezeBlock freeze) {
    int freezableCounter = 0;
    boolean matchingFreezableFound = false;
    while (!matchingFreezableFound && freezableCounter < freeze.getFreezableCount()) {
        IFreezable currentFreezable = freeze.getFreezable(freezableCounter);
        if (currentFreezable.getName() != null && currentFreezable.getName().equals(searchElementName)) {
            matchingFreezableFound = true;
            IDatatype foundType = currentFreezable.getType();
            if (foundType != null) {                    
                elementTypeDescription = new ModelElementDescription(searchElementName, foundType.getName(),
                        getClassTypeFromFreezable(currentFreezable));
            }
        }
        freezableCounter++;
    }
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:18,代码来源:ModelElementTypeFinder.java

示例2: inferDatatype

import net.ssehub.easy.varModel.model.datatypes.IDatatype; //导入方法依赖的package包/类
@Override
public IDatatype inferDatatype() throws CSTSemanticException {
    if (null == result) {
        IDatatype ifType = ifExpr.inferDatatype();
        if (!BooleanType.TYPE.isAssignableFrom(ifType)) {
            throw new CSTSemanticException("if expression type ('"
                + ifType.getName() + "') is not Boolean", CSTSemanticException.TYPE_MISMATCH);
        }
        IDatatype thenType = thenExpr.inferDatatype();
        IDatatype elseType = elseExpr.inferDatatype();
        if (!thenType.isAssignableFrom(elseType)) {
            throw new CSTSemanticException("types of then ('"
                + thenType.getName() + "') and else ('" 
                + elseType.getName() + "') part do not match", CSTSemanticException.TYPE_MISMATCH);
        }
        result = thenType;
    }
    return result;
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:20,代码来源:IfThen.java

示例3: getDroolsType

import net.ssehub.easy.varModel.model.datatypes.IDatatype; //导入方法依赖的package包/类
/**
 * Private method to get the drools type.
 * @param type Type.
 * @return The type to be used in the drools logic for container calls.
 */
private String getDroolsType(IDatatype type) {
    String typ = type.getName();
    if (typ.equals(IntegerType.TYPE.getName()) || containerType.equals(IntegerType.TYPE.getName())) {
        typ = "Number";
    } else if (typ.equals(RealType.TYPE.getName()) || containerType.equals(RealType.TYPE.getName())) {
        typ = "Number";
    } else if (typ.equals(StringType.TYPE.getName()) || containerType.equals(StringType.TYPE.getName())) {
        typ = "String";
    } else if (typ.equals(BooleanType.TYPE.getName()) || containerType.equals(BooleanType.TYPE.getName())) {
        typ = "Boolean";
    } else {
        typ = type.getName();
        if (type.getTypeClass().equals(Sequence.class) || type.getTypeClass().equals(Set.TYPE)) {
            Container cont = (Container) type;
            if (cont.getContainedType().isAssignableFrom(Enum.TYPE) 
                    || cont.getContainedType().isAssignableFrom(OrderedEnum.TYPE)) {
                typ = "Integer";
            }
        }
    }
    
    return typ;
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:29,代码来源:DroolsAssignmentsVisitor.java

示例4: getDroolsType

import net.ssehub.easy.varModel.model.datatypes.IDatatype; //导入方法依赖的package包/类
/**
 * Private method to get the drools type.
 * @param type Type.
 * @return The type to be used in the drools logic for container calls.
 */
private String getDroolsType(IDatatype type) {
    String typ = type.getName();
    if (typ.equals(IntegerType.TYPE.getName()) || containerType.equals(IntegerType.TYPE.getName())) {
        typ = "Number";
    } else if (typ.equals(RealType.TYPE.getName()) || containerType.equals(RealType.TYPE.getName())) {
        typ = "Number";
    } else if (typ.equals(StringType.TYPE.getName()) || containerType.equals(StringType.TYPE.getName())) {
        typ = "String";
    } else if (typ.equals(BooleanType.TYPE.getName()) || containerType.equals(BooleanType.TYPE.getName())) {
        typ = "Boolean";
    } else {
        typ = type.getName();
        if (type.getTypeClass().equals(Sequence.class) || type.getTypeClass().equals(Set.TYPE)) {
            Container cont = (Container) type;
            if (cont.getContainedType().isAssignableFrom(Enum.TYPE) 
                    || cont.getContainedType().isAssignableFrom(OrderedEnum.TYPE)) {
                typ = "Integer";
            }
        }
    } 
    
    return typ;
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:29,代码来源:DroolsEqualityEvaluator.java

示例5: getDroolsType

import net.ssehub.easy.varModel.model.datatypes.IDatatype; //导入方法依赖的package包/类
/**
 * Private method to get the drools type.
 * @param type Type.
 * @return The type to be used in the drools logic for container calls.
 */
private String getDroolsType(IDatatype type) {
    String typ = type.getName();
    if (typ.equals(IntegerType.TYPE.getName()) || containerType.equals(IntegerType.TYPE.getName())) {
        typ = "Number";
    } else if (typ.equals(RealType.TYPE.getName()) || containerType.equals(RealType.TYPE.getName())) {
        typ = "Number";
    } else if (typ.equals(StringType.TYPE.getName()) || containerType.equals(StringType.TYPE.getName())) {
        typ = "String";
    } else if (typ.equals(BooleanType.TYPE.getName()) || containerType.equals(BooleanType.TYPE.getName())) {
        typ = "Boolean";
    } else {
        typ = type.getName();
    }  
    
    return typ;
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:22,代码来源:AssignmentAttributeConstraints.java

示例6: specialTreatment

import net.ssehub.easy.varModel.model.datatypes.IDatatype; //导入方法依赖的package包/类
@Override
protected void specialTreatment(IDecisionVariable variable) {
    if (!variable.isNested()) {
        IDatatype type = variable.getDeclaration().getType();
        String typeName = type.getName();
        
        if (null != typeName) {
            getStatistics().incInstance(typeName);
        }
    }
}
 
开发者ID:QualiMaster,项目名称:QM-EASyProducer,代码行数:12,代码来源:QMConfigStatisticsVisitor.java

示例7: getTypeDescriptor

import net.ssehub.easy.varModel.model.datatypes.IDatatype; //导入方法依赖的package包/类
/**
 * Returns the type descriptor for a given IVML datatype. May lead to a fake/fallback
 * datatype if not known / advised.
 * 
 * @param type the type
 * @return the type or <b>null</b> if unknown
 */
static TypeDescriptor<?> getTypeDescriptor(IDatatype type) {
    TypeRegistry registry = ExecutionLocal.getCurrentTypeRegistry();
    TypeDescriptor<?> result = registry.getTypeOrFallback(type);
    if (null == result && !registry.hasTypeResolver(IvmlTypeResolver.class)) {
        // if there are type resolvers, then there is an @advice that shall provide access to the type
        try {
            TypeDescriptor<?> tmp = registry.getType(Reference.dereference(type));
            result = new FakeTypeDescriptor(registry, type.getName(), tmp);
            registry.registerFallbackType(type, result);
        } catch (VilException e) {
        }
    }
    return result;
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:22,代码来源:IvmlElement.java

示例8: getAllInstances

import net.ssehub.easy.varModel.model.datatypes.IDatatype; //导入方法依赖的package包/类
/**
 * Returns all instances of the given type and sub-types.
 * 
 * @param type the type to look for
 * @return all instances of <code>var</code>, may be <b>null</b> if the instances cannot be retrieved, e.g., in 
 *    case of an integer variable
 */
public Value getAllInstances(IDatatype type) {
    if (null == allInstances) {
        allInstances = new LinkedHashMap<IDatatype, Map<IDecisionVariable, ReferenceValue>>();
    }
    // we need references to variables here in order to allow compound access and modification of variables 
    // in self-constraints
    Map<IDecisionVariable, ReferenceValue> instances = allInstances.get(type);
    Map<IDatatype, Reference> referenceTypes = new HashMap<IDatatype, Reference>();
    Reference rType = new Reference("", type, project);
    referenceTypes.put(type, rType);
    if (null == instances && Compound.TYPE.isAssignableFrom(type)) { // check type restriction
        instances = new HashMap<IDecisionVariable, ReferenceValue>();
        allInstances.put(type, instances);
        for (IDecisionVariable var : decisions.values()) {
            collectAllInstances(var, type, referenceTypes, instances);
        }
    }
    Value result;
    Set setType = new Set(type.getName() + "Instances", rType, null);
    try {
        result = ValueFactory.createValue(setType, null == instances ? null : instances.values().toArray());
    } catch (ValueDoesNotMatchTypeException e) {
        result = null;
    }
    return result;
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:34,代码来源:Configuration.java

示例9: createdDerivedType

import net.ssehub.easy.varModel.model.datatypes.IDatatype; //导入方法依赖的package包/类
/**
 * Created a {@link DerivedDatatype} for testing using <tt>basisType</tt> as basis.
 * @param basisType A {@link IDatatype} which shall be used as basis for the new {@link DerivedDatatype}.
 * @return The newly created {@link DerivedDatatype}.
 */
private DerivedDatatype createdDerivedType(IDatatype basisType) {
    DerivedDatatype derivedType = new DerivedDatatype("Derived" + basisType.getName(), basisType, project);
    project.add(derivedType);
    return derivedType;
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:11,代码来源:DerivedVeriableTest.java

示例10: processCompoundInitializer

import net.ssehub.easy.varModel.model.datatypes.IDatatype; //导入方法依赖的package包/类
/**
 * Processes a compound initializer.
 * 
 * @param lhsType the left hand side type
 * @param context the type context for resolving variables etc.
 * @param parent the parent element
 * @param specificType the specific type of the container
 * @param entryList the entries of the initializer
 * @return the model instance representing the container initializer
 * 
 * @throws TranslatorException in case that the processing of the <code>initializer</code> 
 *   must be terminated abnormally
 * @throws CSTSemanticException in case that the processing of the <code>initializer</code> 
 *   must be terminated abnormally
 * @throws IvmlException in case that the processing of the <code>initializer</code> 
 *   must be terminated abnormally
 * @throws ValueDoesNotMatchTypeException in case that the processing of the <code>initializer</code> 
 *   must be terminated abnormally
 */
private ConstraintSyntaxTree processCompoundInitializer(IDatatype lhsType, TypeContext context,
    IModelElement parent, IDatatype specificType, EList<ExpressionListEntry> entryList)
    throws TranslatorException, CSTSemanticException, IvmlException, ValueDoesNotMatchTypeException {
    level++;
    ConstraintSyntaxTree result;
    Compound comp = (Compound) lhsType;
    context.pushLayer(comp);
    context.addToContext(comp);
    int entryCount = (null == entryList ? 0 : entryList.size());
    ConstraintSyntaxTree[] exprs = new ConstraintSyntaxTree[entryCount];
    String[] slots = new String[entryCount];
    AbstractVariable[] slotDecls = new AbstractVariable[entryCount];
    for (int e = 0; e < entryCount; e++) {
        ExpressionListEntry entry = entryList.get(e);
        if (null != entry.getName()) {
            slots[e] = entry.getName();
            slotDecls[e] = comp.getElement(slots[e]);
            if (null == slotDecls[e]) {
                throw new TranslatorException("field '" + slots[e] + "' does not exist in '"
                    + lhsType.getName() + "'", entry, IvmlPackage.Literals.EXPRESSION_LIST_ENTRY__VALUE,
                    ErrorCodes.UNKNOWN_ELEMENT);
            }
            if (null != entry.getAttrib()) {
                slots[e] += "." + entry.getAttrib();
                slotDecls[e].getAttribute(entry.getAttrib());
                if (null == slotDecls[e]) {
                    throw new TranslatorException("attribute '" + slots[e] + "' does not exist in '"
                        + lhsType.getName() + "'", entry, IvmlPackage.Literals.EXPRESSION_LIST_ENTRY__VALUE,
                        ErrorCodes.UNKNOWN_ELEMENT);
                }
            }
        }
        if (null != entry.getValue()) {
            exprs[e] = processImplicationExpression(entry.getValue(), context, parent);
            exprs[e].inferDatatype();
        }
        if (null != entry.getContainer()) {
            exprs[e] = processLiteralContainer(slotDecls[e].getType(), entry.getContainer(), context, parent);
        }            
    }
    if (allConstant(exprs)) {
        int pos = 0;
        Object[] obj  = new Object[2 + 2 * entryCount];
        obj[pos++] = CompoundValue.SPECIAL_SLOT_NAME_TYPE;
        obj[pos++] = specificType;
        for (int e = 0; e < exprs.length; e++) {
            obj[pos++] = slots[e];
            obj[pos++] = exprs[e];
        }
        result = new ConstantValue(ValueFactory.createValue(lhsType, translateToValues(obj)));
    } else {
        result = new CompoundInitializer(comp, slots, slotDecls, exprs);
    }
    context.popLayer();
    level--;
    return result;
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:77,代码来源:ExpressionTranslator.java

示例11: getOperationsForReturnType

import net.ssehub.easy.varModel.model.datatypes.IDatatype; //导入方法依赖的package包/类
/**
 * Returns all Operations with a specific return type
 * 
 * @param type
 *            the returntype, you want.
 * @return <code>List<StyledString></code> with all operations, ready to
 *         propose. Maybe <b>null</b>.
 */
private List<StyledString> getOperationsForReturnType(String type) {
    List<StyledString> result = null;
    List<Operation> operationList = getAllOperationsCleaned();
    if (!isEmpty(operationList)) {
        result = new ArrayList<StyledString>();
        for (Operation operation : operationList) {
            if (getOperationType("FUNCTION_CALL", operation)) {
                if (operation.getReturns().getName().equals(type)) {
                    StyledString display = new StyledString();
                    String name = operation.getName();
                    boolean hasParameter = false;
                    display.append(name + "(");
                    // setup parameters
                    if (operation.getParameterCount() > 0) {
                        for (int i = 0; i < operation.getParameterCount(); i++) {
                            IDatatype parameter = operation.getParameterType(i);
                            if (parameter != null && parameter.getName() != null && parameter.getType() != null
                                            && parameter.getType().getName() != null) {
                                String paramName = "parameter" + i;
                                String paramType = parameter.getType().getName();
                                display.append(paramType + " " + paramName + ", ");
                            }
                        }
                        hasParameter = true;
                    }
                    if (hasParameter) {
                        String tempdisplay = display.getString();
                        tempdisplay = tempdisplay.substring(0, tempdisplay.length() - 2);
                        display = new StyledString();
                        display.append(tempdisplay);
                    }
                    display.append(")");
                    display.append(" : " + operation.getReturns());
                    result.add(display);
                }
            }
        }
    }

    return result;
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:50,代码来源:IvmlProposalProvider.java

示例12: findNamedVariable

import net.ssehub.easy.varModel.model.datatypes.IDatatype; //导入方法依赖的package包/类
/**
 * Finds a named variable and throws an exception if not found.
 * 
 * @param config
 *            the configuration to search within
 * @param type
 *            the type of the variable
 * @param name
 *            the name of the variable
 * @return the variable
 * @throws ModelQueryException
 *             if not found
 */
public static IDecisionVariable findNamedVariable(Configuration config, IDatatype type, String name)
        throws ModelQueryException {
    IDecisionVariable result = VariableHelper.findNamedVariable(config, type, name);
    if (null == result) {
        throw new ModelQueryException(type.getName() + " '" + name + "' not found",
                ModelQueryException.ACCESS_ERROR);
    }
    return result;
}
 
开发者ID:QualiMaster,项目名称:QM-EASyProducer,代码行数:23,代码来源:Utils.java

示例13: createVar

import net.ssehub.easy.varModel.model.datatypes.IDatatype; //导入方法依赖的package包/类
/**
 * Creates a variable and adds it to the project.
 * Part of the {@link #setUp()} method.
 * @param type The type of the variable to create.
 * @param project The Project where the variable shall be added to.
 */
private static void createVar(IDatatype type, Project project) {
    DecisionVariableDeclaration var = new DecisionVariableDeclaration(type.getName() + "Var", type, project);
    Assert.assertNotNull("Error: Variable of type " + type.getName() + " could not be created.", var);
    project.add(var);
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:12,代码来源:ProjectTestUtilities.java

示例14: ValueDoesNotMatchTypeException

import net.ssehub.easy.varModel.model.datatypes.IDatatype; //导入方法依赖的package包/类
/**
 * Creates a new mismatch exception.
 * 
 * @param value the value which caused the exception
 * @param type the type <code>value</code> does not match to
 * @param code a code representing the cause
 */
public ValueDoesNotMatchTypeException(String value, IDatatype type, int code) {
    this(value, type.getName(), code);
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:11,代码来源:ValueDoesNotMatchTypeException.java


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