當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。