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


Java ModelQueryException.ACCESS_ERROR属性代码示例

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


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

示例1: setPipelines

/**
 * Sets the given <code>pipeline</code> as value in the <code>varName</code> of <code>prj</code>. 
 *
 * @param prj the project to modify
 * @param varName the variable to modify
 * @param pipeline the pipeline to set as (reference) value
 * @return the affected variable
 * @throws ModelQueryException if access to the variable failed
 * @throws CSTSemanticException in case of CST errors
 * @throws ValueDoesNotMatchTypeException if <code>pipeline</code> does not match as a value
 */
private static DecisionVariableDeclaration setPipelines(Project prj, String varName, 
    DecisionVariableDeclaration pipeline) throws ModelQueryException, CSTSemanticException, 
    ValueDoesNotMatchTypeException {
    DecisionVariableDeclaration pipelinesVar = (DecisionVariableDeclaration) ModelQuery.findVariable(prj, 
        varName, DecisionVariableDeclaration.class);
    if (null != pipelinesVar && pipelinesVar.getType() instanceof Container) {
        Container cType = (Container) pipelinesVar.getType();
        ConstraintSyntaxTree cst = new OCLFeatureCall(new Variable(pipelinesVar), IvmlKeyWords.ASSIGNMENT, 
            new ConstantValue(ValueFactory.createValue(cType, pipeline)));
        cst.inferDatatype();
        Constraint constraint = new Constraint(cst, prj);
        prj.addConstraint(constraint);
    } else {
        throw new ModelQueryException("pipelines variable '" + varName + "' not found", 
            ModelQueryException.ACCESS_ERROR);            
    }
    return pipelinesVar;
}
 
开发者ID:QualiMaster,项目名称:QM-EASyProducer,代码行数:29,代码来源:AlgorithmProfileHelper.java

示例2: getValue

/**
 * Returns (a copy) of the value of the <code>slot</code> in <code>var</code>.
 * 
 * @param var the variable to look into
 * @param slot the slot name
 * @return the (copied) value
 * @throws ModelQueryException if the given slot does not exist
 */
private static Value getValue(IDecisionVariable var, String slot) throws ModelQueryException {
    IDecisionVariable nested = var.getNestedElement(slot);
    if (null == nested) {
        throw new ModelQueryException("cannot find slot '" + slot + "' in '" + var.getDeclaration().getName() 
            + "'", ModelQueryException.ACCESS_ERROR);
    }
    Value val = nested.getValue();
    if (null != val) {
        val = val.clone();
    }
    return val;
}
 
开发者ID:QualiMaster,项目名称:QM-EASyProducer,代码行数:20,代码来源:AlgorithmProfileHelper.java

示例3: findAlgorithm

/**
 * Finds an algorithm in <code>family</code>.
 * 
 * @param family
 *            the family
 * @param name
 *            the name of the algorithm
 * @param asReference
 *            return the reference to the algorithm or the algorithm itself
 * @return the algorithm or its reference (depending on <code>asReference</code>)
 * @throws ModelQueryException
 *             if the algorithm cannot be found
 */
public static IDecisionVariable findAlgorithm(IDecisionVariable family, String name, boolean asReference)
        throws ModelQueryException {
    IDecisionVariable result = null;
    IDecisionVariable members = family.getNestedElement(SLOT_FAMILY_MEMBERS);
    if (null == members) {
        throw new ModelQueryException(
                "'" + SLOT_FAMILY_MEMBERS + "' not found in variable '" + family.getDeclaration().getName() + "'",
                ModelQueryException.ACCESS_ERROR);
    }
    for (int n = 0; null == result && n < members.getNestedElementsCount(); n++) {
        IDecisionVariable algoRef = members.getNestedElement(n);
        IDecisionVariable algorithm = Configuration.dereference(algoRef);
        if (VariableHelper.hasName(algorithm, name)) {
            if (asReference) {
                result = algoRef;
            } else {
                result = algorithm;
            }
        }
    }
    if (null == result) {
        throw new ModelQueryException(
                "algorithm '" + name + "' not found in variable '" + family.getDeclaration().getName() + "'",
                ModelQueryException.ACCESS_ERROR);
    }
    return result;
}
 
开发者ID:QualiMaster,项目名称:QM-EASyProducer,代码行数:40,代码来源:Utils.java

示例4: findNamedVariable

/**
 * 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,代码行数:22,代码来源:Utils.java


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