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


Java OCLFeatureCall.getResolvedOperation方法代码示例

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


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

示例1: visitOclFeatureCall

import net.ssehub.easy.varModel.cst.OCLFeatureCall; //导入方法依赖的package包/类
@Override
public void visitOclFeatureCall(OCLFeatureCall call) {
    if (call.getResolvedOperation() == BooleanType.IMPLIES) {
        // exclude the condition
        for (int p = 0; p < call.getParameterCount(); p++) {
            call.getParameter(p).accept(this);
        }
    } else {
        super.visitOclFeatureCall(call);
    }
}
 
开发者ID:QualiMaster,项目名称:Infrastructure,代码行数:12,代码来源:ConstraintClassifier.java

示例2: visitOclFeatureCall

import net.ssehub.easy.varModel.cst.OCLFeatureCall; //导入方法依赖的package包/类
@Override
public void visitOclFeatureCall(OCLFeatureCall call) {
    if (null == call.getResolvedOperation()) {
        addError("Operation of OclFeatureCall could not be resolved.", call,
            ValidationMessage.UNRESOLVED_OPERATION);
    }
    if (null != call.getOperand()) {
        call.getOperand().accept(this);
    } // then call.getAccessor() shall be given!
    for (int i = 0, n = call.getParameterCount(); i < n; i++) {
        call.getParameter(i).accept(this);
    }
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:14,代码来源:IvmlValidationVisitor.java

示例3: visitOclFeatureCall

import net.ssehub.easy.varModel.cst.OCLFeatureCall; //导入方法依赖的package包/类
@Override
public void visitOclFeatureCall(OCLFeatureCall call) {
    if (evaluateOclFeatureCall(call)) {
        opNesting++;
        EvaluationAccessor operand;
        Operation op = call.getResolvedOperation();
        if (null != call.getOperand()) {               
            boolean oldState = setAllowPropagation(op, false);
            call.getOperand().accept(this);
            operand = result;
            result = null; // clear result - kept in operand and released below
            setAllowPropagation(op, oldState); 
        } else {
            operand = null; // custom operation
        }
        EvaluationAccessor[] args = new EvaluationAccessor[op.getParameterCount()];
        boolean allOk = evaluateArguments(call, op, operand, args);
        if (allOk) {
            if (op instanceof CustomOperation) {
                evaluateCustomOperation((CustomOperation) op, operand, args);
            } else {
                IOperationEvaluator evaluator = getOperationEvaluator(op);
                if (null == evaluator) {
                    notImplementedError(null != op ? op.getName() : call.getOperation());
                } else if (null != operand) {
                    result = evaluator.evaluate(operand, args);
                }
            }
            if (null == operand && null != result) { // special isDefined situation
                result.validateContext(context);
            }
        }
        if (null != operand) {
            operand.release();
        }
        release(args);
        opNesting--;
        recordIfFailed(call);
    }
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:41,代码来源:EvaluationVisitor.java

示例4: visitOclFeatureCall

import net.ssehub.easy.varModel.cst.OCLFeatureCall; //导入方法依赖的package包/类
@Override
public void visitOclFeatureCall(OCLFeatureCall call) {
    Operation op = call.getResolvedOperation();
    if (Sequence.AT == op || Sequence.INDEX_ACCESS == op) {
        // TODO can we do this more generically
        canBeDereferenced = true;
    } else {
        canBeDereferenced = false;
    }
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:11,代码来源:RefByCheckVisitor.java

示例5: handleBinaryBoolean

import net.ssehub.easy.varModel.cst.OCLFeatureCall; //导入方法依赖的package包/类
/**
 * Handles an {@link BooleanType#AND}, {@link BooleanType#OR} or {@link BooleanType#XOR} operation. Should evaluate 
 * special situations like <code>undef OR true</code> to <code>true</code>. Dynamically changes evaluation sequence 
 * depending on {@link #containsIsDefined(ConstraintSyntaxTree)}.
 * 
 * @param operand The operand of the OR operation. The operand should already been visited.
 * @param call the call representing the OR operation
 * @return <tt>true</tt> the operation was evaluated successfully, <tt>false</tt> otherwise.
 */
private boolean handleBinaryBoolean(EvaluationAccessor operand, OCLFeatureCall call) {
    boolean hasBeenEvaluated = false;
    Operation op = call.getResolvedOperation();
    EvaluationAccessor operandAccessor = operand;
    EvaluationAccessor parameterAccessor = null;
    ConstraintSyntaxTree parameter = call.getParameter(0);
    if (containsIsDefined(call.getOperand())) {
        if (null != parameter) { // if there is no parameter then no change in result
            // change evaluation sequence - may not help if both contains an isDefined
            parameterAccessor = getAccessor(parameterAccessor, parameter);
            // re-evaluate operand!
            operandAccessor = getAccessor(operandAccessor, call.getOperand());
        }
    }
    if (op == BooleanType.AND) {
        if (null != operandAccessor && operandAccessor.getValue() == BooleanValue.FALSE) {
            result = ConstantAccessor.POOL.getInstance().bind(BooleanValue.FALSE, operand.getContext());
            hasBeenEvaluated = true;
        } else if (null != operand && null != parameter) {
            parameterAccessor = getAccessor(parameterAccessor, parameter);
            if (null != parameterAccessor && parameterAccessor.getValue() == BooleanValue.FALSE) {
                result = ConstantAccessor.POOL.getInstance().bind(BooleanValue.FALSE, operand.getContext());
                hasBeenEvaluated = true;
            }
        }
    } else if (op == BooleanType.OR) {
        if (null != operandAccessor && operandAccessor.getValue() == BooleanValue.TRUE) {
            result = ConstantAccessor.POOL.getInstance().bind(BooleanValue.TRUE, operand.getContext());
            hasBeenEvaluated = true;
        } else if (null != operandAccessor && null != parameter) {
            parameterAccessor = getAccessor(parameterAccessor, parameter);
            if (null != parameterAccessor && parameterAccessor.getValue() == BooleanValue.TRUE) {
                result = ConstantAccessor.POOL.getInstance().bind(BooleanValue.TRUE, operand.getContext());
                hasBeenEvaluated = true;
            }
        }
    } else { // xor
        if (null != operandAccessor && null != parameter) {
            parameterAccessor = getAccessor(parameterAccessor, parameter);
            if (null != parameterAccessor) {
                boolean xorRes = operand.getValue() == BooleanValue.TRUE ^ result.getValue() == BooleanValue.TRUE;
                result = ConstantAccessor.POOL.getInstance().bind(BooleanValue.toBooleanValue(xorRes), 
                    operand.getContext());
                hasBeenEvaluated = true;
            }
        }
    }
    if (null != parameterAccessor) {
        parameterAccessor.release();
    }
    if (operandAccessor != operand) { // we have a temporary operand
        operandAccessor.release();
    }
    return hasBeenEvaluated;
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:65,代码来源:EvaluationVisitor.java

示例6: visitOclFeatureCall

import net.ssehub.easy.varModel.cst.OCLFeatureCall; //导入方法依赖的package包/类
@Override
public void visitOclFeatureCall(OCLFeatureCall call) {
    callStack.push(call);
    FormattingHint hint;
    Operation resolved = call.getResolvedOperation();
    if (null != resolved) {
        hint = resolved.getFormattingHint();
    } else {
        hint = FormattingHint.FUNCTION_CALL;
    }            
    String name = call.getOperation();
    switch (hint) {
    case FUNCTION_CALL:
        if (OclKeyWords.INDEX_ACCESS.equals(name) && 1 == call.getParameterCount()) {
            call.getOperand().accept(this);
            appendOutput("[");
            call.getParameter(0).accept(this);
            appendOutput("]");
        } else {
            appendOutput(name);
            appendOutput("(");
            ConstraintSyntaxTree operand = call.getOperand();
            if (null != operand) {
                operand.accept(this);
            }
            if (call.getParameterCount() > 0) {
                for (int p = 0; p < call.getParameterCount(); p++) {
                    ConstraintSyntaxTree param = call.getParameter(p);
                    if (null != operand || (null == operand && p > 0)) {
                        appendOutput(",");
                    }
                    if (null != param.getName()) {
                        appendOutput(WHITESPACE);
                        appendOutput(param.getName());
                        appendOutput(WHITESPACE);
                        appendOutput("=");
                    }
                    appendOutput(WHITESPACE);
                    param.accept(this);
                }
            }
            appendOutput(")");
        }
        break;
    case OPERATOR_INFIX:
        call.getOperand().accept(this);
        for (int p = 0; p < call.getParameterCount(); p++) {
            appendOutput(WHITESPACE);
            appendOutput(name);
            appendOutput(WHITESPACE);
            call.getParameter(p).accept(this);
        }
        break;
    case OPERATOR_PREFIX:
        appendOutput(name);
        appendOutput(WHITESPACE);
        call.getOperand().accept(this);
        // it is ensured that there are no more parameters
        break;
    case OPERATOR_POSTFIX:
        call.getOperand().accept(this);
        appendOutput(name);
        // it is ensured that there are no more parameters
        break;
    default:
        // should not occur
        break;
    }
    callStack.pop();
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:71,代码来源:IVMLWriter.java

示例7: getTranslator

import net.ssehub.easy.varModel.cst.OCLFeatureCall; //导入方法依赖的package包/类
/**
 * Returns for the given {@link OCLFeatureCall} a {@link TranslationFragment}, which is able to translate
 * the given {@link OCLFeatureCall} automatically into Drools specific code.
 * @param constraint An {@link OCLFeatureCall}, which should be translated 
 * @return A {@link TranslationFragment} instance, which is able to translate the given {@link OCLFeatureCall}
 *     into Drools specific code.
 * @throws CSTSemanticException Will be thrown in case that {@link OCLFeatureCall#inferDatatype()} leads
 *     to this exception.
 */
public static TranslationFragment getTranslator(OCLFeatureCall constraint) throws CSTSemanticException {
    // Ensure that constraint.getResolvedOperation() is possible
    constraint.inferDatatype();
    Operation operation = constraint.getResolvedOperation();
    TranslationFragment translator = TRANSLATION_MAP.get(operation);
    
    return translator;
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:18,代码来源:OCLFeatureTranslationFactory.java


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