當前位置: 首頁>>代碼示例>>Java>>正文


Java OCLFeatureCall.getOperand方法代碼示例

本文整理匯總了Java中net.ssehub.easy.varModel.cst.OCLFeatureCall.getOperand方法的典型用法代碼示例。如果您正苦於以下問題:Java OCLFeatureCall.getOperand方法的具體用法?Java OCLFeatureCall.getOperand怎麽用?Java OCLFeatureCall.getOperand使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.ssehub.easy.varModel.cst.OCLFeatureCall的用法示例。


在下文中一共展示了OCLFeatureCall.getOperand方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: visitOclFeatureCall

import net.ssehub.easy.varModel.cst.OCLFeatureCall; //導入方法依賴的package包/類
@Override
public void visitOclFeatureCall(OCLFeatureCall call) {
    // TODO consider re-assignments of constraint variables
    String op = call.getOperation();
    ConstraintSyntaxTree operand = call.getOperand();
    
    if (OclKeyWords.IS_DEFINED.equals(op)) {
        nextVarIsMandatory = true;
        operand.accept(this);
        nextVarIsMandatory = false;
    } else if (!OclKeyWords.ASSIGNMENT.equals(op) && null != operand) {
        // Most assignments should not be considered
        operand.accept(this);
        for (int i = 0; i < call.getParameterCount(); i++) {
            call.getParameter(i).accept(this);
        }
    }
}
 
開發者ID:SSEHUB,項目名稱:EASyProducer,代碼行數:19,代碼來源:MandatoryDeclarationClassifier.java

示例2: visitOclFeatureCall

import net.ssehub.easy.varModel.cst.OCLFeatureCall; //導入方法依賴的package包/類
@Override
public void visitOclFeatureCall(OCLFeatureCall call) {
    if (null != call.getOperand()) { // user defined function!
        call.getOperand().accept(this);
    }
    
    String op = call.getOperation();
    if (OclKeyWords.INDEX_ACCESS.equals(op) || OclKeyWords.AT.equals(op)) {
        // Index based access to elements of a container
        parents.addFirst(lastVariable);
        for (int i = 0; i < call.getParameterCount(); i++) {
            call.getParameter(i).accept(this);
        }
        parents.removeFirst();
    } else {
        for (int i = 0; i < call.getParameterCount(); i++) {
            call.getParameter(i).accept(this);
        }
    }
}
 
開發者ID:SSEHUB,項目名稱:EASyProducer,代碼行數:21,代碼來源:IDecisionVariableInConstraintFinder.java

示例3: visitOclFeatureCall

import net.ssehub.easy.varModel.cst.OCLFeatureCall; //導入方法依賴的package包/類
@Override
public void visitOclFeatureCall(OCLFeatureCall call) {
    boolean operationIsEquals = (call.getOperation().equals(OclKeyWords.EQUALS));
    boolean operationIsImplies = call.getOperation().equals(OclKeyWords.IMPLIES);

    if (operationIsEquals) {
        if ((call.getOperand() instanceof Variable) || (call.getOperand() instanceof CompoundAccess)) {
            // logger.info("This constraint needs to be there.");
            acceptConstraint = true;
        }
    } else if (operationIsImplies) {
        if (call.getParameter(0).getClass().equals(call.getClass())) {
            OCLFeatureCall temp = (OCLFeatureCall) call.getParameter(0);
            if (temp.getOperation().equals(OclKeyWords.EQUALS)) {
                // logger.info("this should also be included.");
                acceptConstraint = true;
            }
        } else if (call.getParameter(0) instanceof Parenthesis) {
            OCLFeatureCall temp2 = new OCLFeatureCall(call.getOperand(), OclKeyWords.IMPLIES,
                    ((Parenthesis) call.getParameter(0)).getExpr());
            temp2.accept(this);
        }
    }

}
 
開發者ID:SSEHUB,項目名稱:EASyProducer,代碼行數:26,代碼來源:DroolsEvaluation.java

示例4: processModificationForCompoundAccess

import net.ssehub.easy.varModel.cst.OCLFeatureCall; //導入方法依賴的package包/類
/**
 * Process modification rules, where operand is a compound access.
 * @param call OCL Call.
 * @param constraintRule A string representation of Drools "not" of this this call.
 */
private void processModificationForCompoundAccess(OCLFeatureCall call, 
        String constraintRule) {
    compoundAccessSlot = "";
    call.getOperand().accept(this);
    assgnConstraintsCalls(call);
    
    compoundAccessSlot = "";
    CompoundAccess cac = (CompoundAccess) call.getOperand();
    boolean isContainer = cac.getResolvedSlot().getType().getTypeClass().equals(Sequence.class)
            || cac.getResolvedSlot().getType().getTypeClass().equals(Set.class);
    if (!(isContainer && (call.getParameter(0) instanceof ConstantValue))) {
        logger.info("");
        //TODO: NOT SURE, TO BE IMPLEMENTED
    }
    hardConstraints.add(constraintRule);
}
 
開發者ID:SSEHUB,項目名稱:EASyProducer,代碼行數:22,代碼來源:DroolsVisitor.java

示例5: processModificationForVariable

import net.ssehub.easy.varModel.cst.OCLFeatureCall; //導入方法依賴的package包/類
/**
     * Process modification rules, where operand is a variable.
     * @param call OCL Call.
     * @param constraintRule A string representation of Drools "not" of this this call.
     */
    private void processModificationForVariable(OCLFeatureCall call, 
            String constraintRule) {
        Variable var = (Variable) call.getOperand();
        String name = ((Variable) call.getOperand()).getVariable().getName();
        assgnConstraintsCalls(call);
        addAssinmentConstraintsToMap(constraintRule, name);
        configuredByDefaultList.add(name);
        
        boolean varIsContainer = var.getVariable().getType().getTypeClass().equals(Sequence.class)
                || var.getVariable().getType().getTypeClass().equals(Set.class);
//                        boolean varIsCompound = var.getVariable().getType().getTypeClass().equals(Compound.class);
        if (!varIsContainer ) {
            logger.info("");
        }
    }
 
開發者ID:SSEHUB,項目名稱:EASyProducer,代碼行數:21,代碼來源:DroolsVisitor.java

示例6: visitOclFeatureCall

import net.ssehub.easy.varModel.cst.OCLFeatureCall; //導入方法依賴的package包/類
@Override
public void visitOclFeatureCall(OCLFeatureCall call) {
    if (null != call.getOperand()) {    
        // user def function returns operand null!
        if ((call.getOperand() instanceof Variable
            || call.getOperand() instanceof CompoundAccess)
            && call.getParameterCount() == 1
            && call.getOperation().equals(OclKeyWords.ASSIGNMENT)) {
            if (call.getParameter(0) instanceof ConstantValue
                || call.getParameter(0) instanceof ContainerInitializer
                || call.getParameter(0) instanceof CompoundInitializer) {
                isSimpleAssignment = true; 
            }
        } 
        call.getOperand().accept(this);
        for (int i = 0; i < call.getParameterCount(); i++) {
            call.getParameter(i).accept(this);
        }
    }
}
 
開發者ID:SSEHUB,項目名稱:EASyProducer,代碼行數:21,代碼來源:VariablesInConstraintsFinder.java

示例7: getCompoundConstraintType

import net.ssehub.easy.varModel.cst.OCLFeatureCall; //導入方法依賴的package包/類
/**
 * Type of call the constraint in the compound represents, modification or hard.
 * @param call OCL Call.
 * @return Returns the type of the call. 0 if modification, else 1.
 */
private int getCompoundConstraintType(OCLFeatureCall call) {
    
    boolean operationIsEquals = (call.getOperation().equals(OclKeyWords.EQUALS)); 
    boolean operationIsAssignment = (call.getOperation().equals(OclKeyWords.ASSIGNMENT));
    boolean isModification = operationIsEquals || operationIsAssignment;
    
    int operationTyp = 1;
    
    if (isModification) {
        if (call.getOperand() instanceof Variable) {
            operationTyp = 0;
        } else if (call.getOperand() instanceof CompoundAccess) {
            operationTyp = 0;
        } else {
            operationTyp = 1;
        }
    } else {
        
        if (call.getOperation().equals(OclKeyWords.IMPLIES)) {
            boolean theRHSisOCL = call.getParameter(0) instanceof OCLFeatureCall;
            if (theRHSisOCL) {
                OCLFeatureCall call2 = (OCLFeatureCall) call.getParameter(0);
                if (call2.getOperation().equals(OclKeyWords.EQUALS) && call2.getParameterCount() == 1) {
                    if (call2.getOperand() instanceof Variable || call2.getOperand() instanceof CompoundAccess) {
                        operationTyp = 2;
                    }
                }
            }
        } else {
            operationTyp = 1;
        }
    }
    
    return operationTyp;
}
 
開發者ID:SSEHUB,項目名稱:EASyProducer,代碼行數:41,代碼來源:DroolsVisitor.java

示例8: testInternalConstraint

import net.ssehub.easy.varModel.cst.OCLFeatureCall; //導入方法依賴的package包/類
/**
 * Test whether the given <code>DecsionVariableDeclaration</code> (instance of a <code>DerivedDatatype</code>
 * is embedded into the last created internal constraint. For this test, the <code>DerivedDatatype</code>
 * must have only one <code>OCLFeatureCall</code> constraint with itself as operand.
 * 
 * @param constraint The origin constraint of the <code>DerivedDatatype</code>.
 * This test checks also whether the newly created constraint has the same structure.
 * @param derivedTypeInstance The instance of a <code>DerivedDatatype</code>,
 * which should occur inside the internal constraint.
 */
private void testInternalConstraint(OCLFeatureCall constraint, DecisionVariableDeclaration derivedTypeInstance) {
    Constraint internalConstraint = project.getInternalConstraint(countInternalConstraints - 1);
    OCLFeatureCall testCST = (OCLFeatureCall) internalConstraint.getConsSyntax();
    
    //Test correct behavior of the internal cosntraint
    Assert.assertNotNull(testCST);
    Variable variable = (Variable) testCST.getOperand();
    Assert.assertEquals(derivedTypeInstance, variable.getVariable());
    Assert.assertEquals(constraint.getOperation(), testCST.getOperation());
}
 
開發者ID:SSEHUB,項目名稱:EASyProducer,代碼行數:21,代碼來源:DerivedDatatypeTest.java

示例9: 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

示例10: 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

示例11: visitOclFeatureCall

import net.ssehub.easy.varModel.cst.OCLFeatureCall; //導入方法依賴的package包/類
@Override
public void visitOclFeatureCall(OCLFeatureCall call) {
    if (null != call.getOperand()) {
        call.getOperand().accept(this);
    }
    for (int p = 0, n = call.getParameterCount(); p < n; p++) {
        call.getParameter(p).accept(this);
    }
}
 
開發者ID:SSEHUB,項目名稱:EASyProducer,代碼行數:10,代碼來源:StaticAccessFinder.java

示例12: assgnConstraintsCalls

import net.ssehub.easy.varModel.cst.OCLFeatureCall; //導入方法依賴的package包/類
/**
 * A private method to process OCL calls that are assignment constraints.
 * @param call OCL Call.
 */
private void assgnConstraintsCalls(OCLFeatureCall call) {
    boolean toAdd = true; 
    if (call.getOperand() instanceof Variable) {
        Variable var = (Variable) call.getOperand();
        String varName = var.getVariable().getName();
        if (!DroolsVariablesPreProcessor.getVariablesUsed().contains(varName)
                && optimize
                && !var.getVariable().getType().isAssignableFrom(Compound.TYPE)) {
            toAdd = false;
        }
    }
    
    if (toAdd) {
        droolsAssgnVis = new DroolsAssignmentsVisitor();
        DroolsAssignmentsVisitor.setRuleCount(ruleCount);
        droolsAssgnVis.visitOclFeatureCall(call);
        if (droolsAssgnVis.isRuleNotSupported()) {
            logger.info("rule not supported is " + ruleCount);
            listofUnsupportedRules.add(ruleCount);
        }
        String rule = droolsAssgnVis.getRule();
        assgnConstraints.add(rule);
    }
    
    
    
}
 
開發者ID:SSEHUB,項目名稱:EASyProducer,代碼行數:32,代碼來源:DroolsVisitor.java

示例13: visitOclFeatureCall

import net.ssehub.easy.varModel.cst.OCLFeatureCall; //導入方法依賴的package包/類
@Override
public void visitOclFeatureCall(OCLFeatureCall call) {
    if (null != call.getOperand()) { // user defined function!
        call.getOperand().accept(this);
    }
    for (int i = 0; i < call.getParameterCount(); i++) {
        call.getParameter(i).accept(this);
    }
}
 
開發者ID:SSEHUB,項目名稱:EASyProducer,代碼行數:10,代碼來源:AbstractVariableInConstraintFinder.java

示例14: visitOclFeatureCall

import net.ssehub.easy.varModel.cst.OCLFeatureCall; //導入方法依賴的package包/類
@Override
public void visitOclFeatureCall(OCLFeatureCall call) {
    if (null != call.getOperand()) {
        call.getOperand().accept(this);
    }
    for (int p = 0; p < call.getParameterCount(); p++) {
        call.getParameter(p).accept(this);
    }
}
 
開發者ID:SSEHUB,項目名稱:EASyProducer,代碼行數:10,代碼來源:VariableUsage.java

示例15: visitOclFeatureCall

import net.ssehub.easy.varModel.cst.OCLFeatureCall; //導入方法依賴的package包/類
@Override
public void visitOclFeatureCall(OCLFeatureCall call) {
    isAssignment = CSTUtils.isAssignment(call);
    if (continueTraversal()) {
        level++;
        if (null != call.getOperand()) { // incomplete xText
            call.getOperand().accept(this);
            for (int p = 0; !isAssignment && p < call.getParameterCount(); p++) {
                call.getParameter(p).accept(this);
            }
        }
        level--;
    }
}
 
開發者ID:SSEHUB,項目名稱:EASyProducer,代碼行數:15,代碼來源:AssignmentDetector.java


注:本文中的net.ssehub.easy.varModel.cst.OCLFeatureCall.getOperand方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。