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


Java Variable.getVariable方法代码示例

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


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

示例1: visitVariable

import net.ssehub.easy.varModel.cst.Variable; //导入方法依赖的package包/类
@Override
public void visitVariable(Variable variable) {
    AbstractVariable var = variable.getVariable();
    if (!defined.contains(var) && null == variable.getQualifier()) {
        // unqualified compound slot use in constraint in compound
        if (var instanceof DecisionVariableDeclaration) {
            IModelElement par = var.getParent();
            while (null != par && par instanceof AttributeAssignment) {
                par = par.getParent();
            }
            if (par instanceof Compound) {
                result.add((DecisionVariableDeclaration) var);
            }
        }
    }
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:17,代码来源:StaticAccessFinder.java

示例2: visitVariable

import net.ssehub.easy.varModel.cst.Variable; //导入方法依赖的package包/类
@Override
public void visitVariable(Variable variable) {
    AbstractVariable decl = variable.getVariable();
    if (nextVarIsMandatory) {
        IModelElement parent = decl.getParent();
        if (parent instanceof DerivedDatatype) {
            List<AbstractVariable> instances = getDeclarationsByType((DerivedDatatype) parent);
            if (null != instances) {
                for (int i = 0, end = instances.size(); i < end; i++) {
                    setImportanceForAllInstancesOfDeclaration(instances.get(i), Importance.MANDATORY);
                }
            }
        } else {
            String qName = context.hasParent() ? getSlotOfCompound(decl) : decl.getQualifiedName();
            context.elementFound();
            varContainer.setImportance(qName, Importance.MANDATORY);
            if (context.depth() > 0) {
                context.addParent(qName);
            }
        }
    }
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:23,代码来源:MandatoryDeclarationClassifier.java

示例3: visitVariable

import net.ssehub.easy.varModel.cst.Variable; //导入方法依赖的package包/类
@Override
public void visitVariable(Variable variable) {
    AbstractVariable var = variable.getVariable();
    boolean needsFqn = false;
    if (null != variable.getQualifier()) {
        variable.getQualifier().accept(this);
        appendOutput(".");
    } else {
        needsFqn = needsQualification(variable.getVariable()); 
    }
    if (needsFqn) {
        appendOutput(var.getQualifiedName());
    } else {
        appendOutput(var.getName());
    }
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:17,代码来源:IVMLWriter.java

示例4: visitVariable

import net.ssehub.easy.varModel.cst.Variable; //导入方法依赖的package包/类
@Override
public void visitVariable(Variable variable) {
    AbstractVariable decl = variable.getVariable();
    String name = decl.getName();
    // Workaround for variable in assignments
    if (decl.getParent().getParent() == null) {            
        append("$" + name);
    } else if (decl.getParent().getClass().getSimpleName().equals("AttributeAssignment") 
        && decl.getParent().getParent().getClass().getSimpleName().equals("Project")) {
        append("$" + name);            
    } else if (decl.getParent().getClass().getSimpleName().equals("Compound")
        || (decl.getParent().getClass().getSimpleName().equals("AttributeAssignment")
            && decl.getParent().getParent().getClass().getSimpleName().equals("Compound"))) {
        append(createCompoundAccess(decl));
        
    } else {
        append(createCompoundAccess(decl));        
    }
    appendVariableAccess();
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:21,代码来源:CompoundConstraintTranslator.java

示例5: visitVariable

import net.ssehub.easy.varModel.cst.Variable; //导入方法依赖的package包/类
@Override
public void visitVariable(Variable var) {
    AbstractVariable aVar = var.getVariable();
    if (null != aVar) {
        IDecisionVariable decVar = variables.get(aVar);
        if (null != decVar) { // if found (already classified as runtime enact)
            found.add(decVar);
        }
    }
}
 
开发者ID:QualiMaster,项目名称:Infrastructure,代码行数:11,代码来源:ConstraintClassifier.java

示例6: mapLeaf

import net.ssehub.easy.varModel.cst.Variable; //导入方法依赖的package包/类
@Override
public ConstraintSyntaxTree mapLeaf(Variable variable) {
    ConstraintSyntaxTree result = null;
    AbstractVariable var = variable.getVariable();
    for (int i = 0; null == result && i < decls.size(); i++) { // put into map???
        if (decls.get(i) == var) {
            result = new CompoundAccess(iter, var.getName());
        }
    }
    return result;
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:12,代码来源:EvaluationUtils.java

示例7: visitVariable

import net.ssehub.easy.varModel.cst.Variable; //导入方法依赖的package包/类
@Override
public void visitVariable(Variable variable) {
    AbstractVariable var = variable.getVariable();
    String name = var.getName();
    AbstractVariable unQ = mapping.get(name);
    boolean put;
    if (null == unQ) {
        put = true;
    } else {
        put = getImportPos(var) < getImportPos(unQ);
    }
    if (put) {
        mapping.put(name, var);
    }
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:16,代码来源:VariableUsage.java

示例8: visitingVariableTobeModified

import net.ssehub.easy.varModel.cst.Variable; //导入方法依赖的package包/类
/**
 * Method to process visiting the variable to be modified.
 * @param variable Variable.
 * @param variableName name of the variable.
 */
private void visitingVariableTobeModified(Variable variable, String variableName) {
    boolean parentIsACompound = variable.getVariable().getParent().getClass().equals(Compound.class);
    if ((variable.getVariable().getType().getTypeClass().equals(Compound.class))
            && !parentIsACompound) {
        /**
         * Modifying variable whose type is compound.
         */
        modifyCompoundTypeVariable(variableName);
    } else if (variable.getVariable().getParent().getClass().equals(Compound.class)) {
        /**
         * Modifying variable declared in a compound, i.e. variable whose parent is compound.
         * Used for constraints expressed in a compound. 
         */
        modifyVariableDeclaredInCompound(variable);
    } else {
        if (variable.getVariable() instanceof Attribute) {
            Attribute attr = (Attribute) variable.getVariable();
            variableName = "$attr_" + attr.getElement().getName() + "_"
                    + attr.getName();
        }
        if (DroolsVisitor.getDroolsClasseMap().get(variableName) == null) {
            logger.info("null name " + variableName);
        }
        modifyingClassnr = DroolsVisitor.getDroolsClasseMap().get(variableName) / DroolsVisitor.THRESHOLD;
        int thr = writeDroolsClassPattern(variableName);
        modclass = "P" + thr; 
        rule += variableName;
        dListAdder = variableName;
        /*
         * For future, in case only one group be used for all the rules for direct modification.
         * Similar change needs to be made in the class  DroolsConstraintVisitor suitably.
         * 
         * 
         */
        patternList.add("!vList.contains(" + "\"" + variableName  + "\") ");
        
        
    }
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:45,代码来源:DroolsAssignmentsVisitor.java

示例9: constraintLogic

import net.ssehub.easy.varModel.cst.Variable; //导入方法依赖的package包/类
/**
 * Private method to write the constraint logic.
 * Note: the param name can be extracted from variable, but here it is being passed
 * for the sake of convenience. 
 * @param variable variable.
 * @param name Name.
 */
private void constraintLogic(Variable variable, String name) {
    String patternToAdd = "isDefined(" + "P." + name + ")";
    boolean isDerivedType = variable.getVariable().getType().getTypeClass().equals(DerivedDatatype.class);
    boolean isCompoundType = variable.getVariable().getType().getTypeClass().equals(Compound.class);
    if (isDerivedType) {
        logger.info("");
    }
    if (isCompoundType) {
        patternToAdd = writeConstraintLogicForCompoundVariable(variable, name);
    } 
    if ((variable.getVariable().getType().getTypeClass().equals(Compound.class))) {
        notModification(name, patternToAdd, variable);
    } else if (variable.getVariable().getParent().getClass().equals(Compound.class)) {
        writeConstraintLogicForNestedElement(variable, name, isDerivedType);
    } else {
        if (variable.getVariable().getParent().getClass().equals(Project.class)) {
            if (variable.getVariable() instanceof Attribute) {
                Attribute attr = (Attribute) variable.getVariable();
                name = "$attr_" + attr.getElement().getName() + "_"
                        + attr.getName();
            }
            pattern.add(variableStatusChecker + "(" + "\"" + name + letSuffix + "\") ");
            if (currentOp.equals("ivmlDef")) { 
                constraint += "dList, " + "\"" + name;  
            } else {
                writeConstraintLogicForNonNestedElement(variable, name);
            }
        } else if (variable.getVariable().getParent().getClass().equals(Constraint.class)) {
            // Mainly for the variables used in Let expressions. Parent is Constraint.
            writeConstraintLogicForNonNestedElement(variable, name);
        } else {
            logger.info("name and parent " + name + " " + variable.getVariable().getParent().getClass());
            ruleSupported = false;
        }
    }
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:44,代码来源:DroolsEqualityEvaluator.java

示例10: constraintLogic

import net.ssehub.easy.varModel.cst.Variable; //导入方法依赖的package包/类
/**
 * Private method to write the constraint logic.
 * Note: the param name can be extracted from variable, but here it is being passed
 * for the sake of convenience. 
 * @param variable variable.
 * @param name Name.
 */
private void constraintLogic(Variable variable, String name) {
    String patternToAdd = "isDefined(" + "P." + name + ")";
    boolean isDerivedType = variable.getVariable().getType().getTypeClass().equals(DerivedDatatype.class);
    boolean isCompoundType = variable.getVariable().getType().getTypeClass().equals(Compound.class);
    if (isDerivedType) {
        logger.info("");
    }
    if (isCompoundType) {
        patternToAdd = writeConstraintLogicForCompoundVariable(variable, name);
    } 
    if ((variable.getVariable().getType().getTypeClass().equals(Compound.class))) {
        notModification(name, patternToAdd, variable);
    } else if (variable.getVariable().getParent().getClass().equals(Compound.class)) {
        writeConstraintLogicForNestedElement(variable, name, isDerivedType);
    } else {
        if (variable.getVariable().getParent().getClass().equals(Project.class)) {
            if (variable.getVariable() instanceof Attribute) {
                Attribute attr = (Attribute) variable.getVariable();
                name = "$attr_" + attr.getElement().getName() + "_"
                        + attr.getName();
            }
            pattern.add(dListContains + "(" + "\"" + name + letSuffix + "\") ");
            if (rhsCounter > 0) {
                rhsPattern.add(dListContains + "(" + "\"" + name + letSuffix + "\") ");
            }
            if (currentOp.equals("ivmlDef")) {
                constraint += "dList, " + "\"" + name; 
            } else {
                writeConstraintLogicForNonNestedElement(variable, name);
            }
        } else if (variable.getVariable().getParent().getClass().equals(Constraint.class)) {
            // Mainly for the variables used in Let expressions. Parent is Constraint.
            writeConstraintLogicForNonNestedElement(variable, name);
        } else {
            logger.info("name and parent " + name + " " + variable.getVariable().getParent().getClass());
            ruleSupported = false;
        }
    }
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:47,代码来源:DroolsImpliesEvaluator.java

示例11: visitVariable

import net.ssehub.easy.varModel.cst.Variable; //导入方法依赖的package包/类
@Override
public void visitVariable(Variable variable) {
    AbstractVariable decl = variable.getVariable();
    String name = decl.getName();        
    append("$" + name);
    appendVariableAccess();
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:8,代码来源:ConstraintTranslator.java

示例12: visitVariable

import net.ssehub.easy.varModel.cst.Variable; //导入方法依赖的package包/类
@Override
public void visitVariable(Variable variable) {
    if (null == variable.getVariable()) {
        addError("link to variable declaration must not be <null>", variable, ValidationMessage.IS_NULL);
    }
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:7,代码来源:IvmlValidationVisitor.java

示例13: visitVariable

import net.ssehub.easy.varModel.cst.Variable; //导入方法依赖的package包/类
@Override
public void visitVariable(Variable variable) {
    AbstractVariable decl = variable.getVariable();
    UsedProjectFinder.visitAbstractDeclaration(decl, usedProjects);
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:6,代码来源:ProjectsInCSTFinder.java

示例14: visitVariable

import net.ssehub.easy.varModel.cst.Variable; //导入方法依赖的package包/类
@Override
public void visitVariable(Variable variable) {
    AbstractVariable wrappedDeclaration = variable.getVariable();        
    variables.add(wrappedDeclaration);
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:6,代码来源:VariablesInConstraintsFinder.java

示例15: constraintRetrievalTest

import net.ssehub.easy.varModel.cst.Variable; //导入方法依赖的package包/类
/**
 * Test whether all constraints are retrieved correctly. At this moment only normal and internal constraints.
 */
@Test
public void constraintRetrievalTest() {     
    Project project = loadProject("ConstraintRetrievalCheck.ivml");
    Configuration config = new Configuration(project, true);
    ReasonerModel rModel = new ReasonerModel(config, null);
   
    // Normal Constraints
    List<ConstraintSyntaxTree> normalConstaintList
        = new ArrayList<ConstraintSyntaxTree>(rModel.getNormalConstraintCount());
    for (int i = 0; i < rModel.getNormalConstraintCount(); i++) {
        normalConstaintList.add(rModel.getNormalConstraint(i));
    }
    printConstraints(normalConstaintList);
    
    // Test normal constraints
    System.out.println("Normal constraint count: " + normalConstaintList.size());
    Assert.assertEquals("Number of normal constraints", 9, normalConstaintList.size());

    //Internal Constraints
    List<ConstraintSyntaxTree> internalConstaintList
        = new ArrayList<ConstraintSyntaxTree>(rModel.getInternalConstraintCount());
    for (int i = 0; i < rModel.getInternalConstraintCount(); i++) {
        internalConstaintList.add(rModel.getInternalConstraint(i));
    }
    printConstraints(internalConstaintList);
    
    
    // Test internal constraints
    System.out.println("Internal constraint count: " + internalConstaintList.size());
    Assert.assertEquals("Number of internal constraints", 3, internalConstaintList.size());
    for (int i = 0; i < internalConstaintList.size(); i++) {            
        OCLFeatureCall constraint = (OCLFeatureCall) internalConstaintList.get(i);
        Variable variable = (Variable) constraint.getOperand();
        AbstractVariable decl = variable.getVariable();
        IDatatype type = decl.getType();
        Assert.assertEquals(DerivedDatatype.class, type.getClass());
    }
    
    // Test ReasonerDatatypes
    int nDatatypes = 0;
    Iterator<ReasonerDatatype> datatypeIterator = rModel.datatypeIterator();
    while (datatypeIterator.hasNext()) {
        nDatatypes++;
        ReasonerDatatype customType = datatypeIterator.next();
        if (customType instanceof EnumType) {
            EnumType enumType = (EnumType) customType;
            if (enumType.getName().equals("View")) {
                Assert.assertEquals(0, enumType.getMinOrdinal());
                Assert.assertEquals(2, enumType.getMaxOrdinal());
                Assert.assertTrue(enumType.isValidOrdinal(1));
                Assert.assertFalse(enumType.isValidOrdinal(enumType.getMaxOrdinal() + 1));
                Assert.assertFalse(enumType.isValidOrdinal(enumType.getMinOrdinal() - 1));
            } else if (enumType.getName().equals("ContentType")) {
                Assert.assertEquals(1, enumType.getMinOrdinal());
                Assert.assertEquals(8, enumType.getMaxOrdinal());
                Assert.assertFalse(enumType.isValidOrdinal(3));
                Assert.assertTrue(enumType.isValidOrdinal(4));
                Assert.assertFalse(enumType.isValidOrdinal(5));
                Assert.assertFalse(enumType.isValidOrdinal(enumType.getMaxOrdinal() + 1));
                Assert.assertFalse(enumType.isValidOrdinal(enumType.getMinOrdinal() - 1));
            }
        } else {
            CompoundType cmpType = (CompoundType) customType;
            Assert.assertEquals(3, cmpType.getConstraintCount());
        }
    }
    Assert.assertEquals(3, nDatatypes);
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:72,代码来源:ReasonerModelTest.java


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