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


Java AbstractVariable类代码示例

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


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

示例1: isRuntimeEnact

import net.ssehub.easy.varModel.model.AbstractVariable; //导入依赖的package包/类
/**
 * Returns whether the given variable has runtime enact as binding time.
 * 
 * @param var the variable to test
 * @return <code>true</code> for runtime-enact, <code>false</code> else
 */
private boolean isRuntimeEnact(IDecisionVariable var) {
    boolean result = false;
    for (int a = 0; a < var.getAttributesCount(); a++) {
        IDecisionVariable attribute = var.getAttribute(a);
        AbstractVariable decl = attribute.getDeclaration();
        if (QmConstants.ANNOTATION_BINDING_TIME.equals(decl.getName())) {
            Value val = attribute.getValue();
            if (val instanceof EnumValue) {
                EnumValue eVal = (EnumValue) val;
                if (eVal.getValue().getName().equals(QmConstants.CONST_BINDING_TIME_RUNTIME_ENACT)) {
                    result = true;
                }
            }
        }
    }
    return result;
}
 
开发者ID:QualiMaster,项目名称:Infrastructure,代码行数:24,代码来源:ConstraintClassifier.java

示例2: collectAlgorithmParameters

import net.ssehub.easy.varModel.model.AbstractVariable; //导入依赖的package包/类
/**
 * Collects the parameters of all algorithms in <code>config</code>.
 * 
 * @param config the configuration to take into account
 * @param algorithms the algorithms variable in <code>config</code>
 * @return the algorithm-parameter mapping
 */
private Map<String, List<AlgorithmParameter>> collectAlgorithmParameters(Configuration config, 
    AbstractVariable algorithms) {
    Map<String, List<AlgorithmParameter>> result = new HashMap<String, List<AlgorithmParameter>>();
    IDecisionVariable var = config.getDecision(algorithms);
    if (var instanceof ContainerVariable) {
        ContainerVariable cVar = (ContainerVariable) var;
        for (int n = 0; n < cVar.getNestedElementsCount(); n++) {
            IDecisionVariable elt = var.getNestedElement(n);
            if (elt instanceof CompoundVariable) {
                CompoundVariable comp = (CompoundVariable) elt;
                String name = toString(comp.getNestedVariable("name"));
                if (null != name) {
                    List<AlgorithmParameter> param = collectAlgorithmParameters(
                        comp.getNestedVariable("parameters"));
                    if (null != param) {
                        result.put(name, param);
                    }
                }
            }
        }
    }
    return result;
}
 
开发者ID:QualiMaster,项目名称:Infrastructure,代码行数:31,代码来源:TracingTask.java

示例3: isRelevantVariable

import net.ssehub.easy.varModel.model.AbstractVariable; //导入依赖的package包/类
@Override
protected boolean isRelevantVariable(IDecisionVariable var) {
    boolean found = false;
    if (null != var) {
        for (int a = 0; !found && a < var.getAttributesCount(); a++) {
            IDecisionVariable attribute = var.getAttribute(a);
            AbstractVariable decl = attribute.getDeclaration();
            if (QmConstants.ANNOTATION_BINDING_TIME.equals(decl.getName())) {
                Value val = attribute.getValue();
                if (val instanceof EnumValue) {
                    EnumValue eVal = (EnumValue) val;
                    found = (eVal.getValue().getName().startsWith("runtime"));
                }
            }
        }
        found = found && isActive(var, state, pipStatus);
    }
    return found;
}
 
开发者ID:QualiMaster,项目名称:Infrastructure,代码行数:20,代码来源:ReasoningTask.java

示例4: freezeProject

import net.ssehub.easy.varModel.model.AbstractVariable; //导入依赖的package包/类
/**
 * Adds freezes blocks to the configuration projects.
 * @param baseProject The copied QM model (the starting point, which imports all the other models).
 */
private void freezeProject(Project baseProject) {
    DeclarationFinder finder = new DeclarationFinder(baseProject, FilterType.ALL, null);
    List<DecisionVariableDeclaration> allDeclarations = new ArrayList<DecisionVariableDeclaration>();
    List<AbstractVariable> tmpList = finder.getVariableDeclarations(VisibilityType.ALL);
    for (int i = 0, end = tmpList.size(); i < end; i++) {
        AbstractVariable declaration = tmpList.get(i);
        if (declaration instanceof DecisionVariableDeclaration
            && !(declaration.getNameSpace().equals(QmConstants.PROJECT_OBSERVABLESCFG)
            && declaration.getName().equals("qualityParameters"))) {
            
            allDeclarations.add((DecisionVariableDeclaration) declaration);
        }
    }
    ProjectRewriteVisitor rewriter = new ProjectRewriteVisitor(baseProject, FilterType.ALL);
    ProjectFreezeModifier freezer = new ProjectFreezeModifier(baseProject, allDeclarations);
    rewriter.addProjectModifier(freezer);
    baseProject.accept(rewriter);
}
 
开发者ID:QualiMaster,项目名称:QM-EASyProducer,代码行数:23,代码来源:ModelModifier.java

示例5: getCompoundNameAndType

import net.ssehub.easy.varModel.model.AbstractVariable; //导入依赖的package包/类
/**
 * Returns a map which key is the variable name, value is the variable type.
 * 
 * @param decisionDeclaration
 *            the compound decisionVariable
 * @return a map with variableName and variableType
 */
public static Map<String, IDatatype> getCompoundNameAndType(AbstractVariable decisionDeclaration) {

    String compoundName = null;
    Map<String, IDatatype> map = new HashMap<String, IDatatype>();
    Compound compoundType = (Compound) decisionDeclaration.getType();
    for (int i = 0; i < compoundType.getInheritedElementCount(); i++) {
        DecisionVariableDeclaration nestedDecl = compoundType.getInheritedElement(i);
        compoundName = nestedDecl.getName();
        IDatatype type = nestedDecl.getType();
        if (type instanceof Reference) {
            Reference refType = (Reference) type;
            map.put(compoundName, refType);
        } else {
            map.put(compoundName, type);

        }
    }
    return map;
}
 
开发者ID:QualiMaster,项目名称:QM-EASyProducer,代码行数:27,代码来源:BasicIVMLModelOperations.java

示例6: createAssignmentConstraint

import net.ssehub.easy.varModel.model.AbstractVariable; //导入依赖的package包/类
@Override
    protected ConstraintSyntaxTree createAssignmentConstraint(Project dstProject, AbstractVariable decl, 
        IDecisionVariable var, Value value) {
        Configuration config = var.getConfiguration();
        AbstractVariable dstDecl = null != varMapping ? varMapping.get(decl) : decl;
        if (null == dstDecl) {
            dstDecl = decl;
        }
        // do some referential integrity ;)
        ConstraintSyntaxTree rightSide = null;
        if (Reference.TYPE.isAssignableFrom(value.getType())) {
            // search for sequence in imported models
            rightSide = searchSequenceValue(dstProject, value, config);
        }
        if (null == rightSide) {
            // fallback
            rightSide = new ConstantValue(toSaveableValue(var, value));
        }
        ConstraintSyntaxTree constraint = new OCLFeatureCall(deriveOperand(dstDecl, var), 
            OclKeyWords.ASSIGNMENT, rightSide);
//        CopyVisitor vis = new CopyVisitor(varMapping);
//        constraint.accept(vis);
//        return vis.getResult();
        return constraint;
    }
 
开发者ID:QualiMaster,项目名称:QM-EASyProducer,代码行数:26,代码来源:QualiMasterConfigurationSaver.java

示例7: isSavingEnabled

import net.ssehub.easy.varModel.model.AbstractVariable; //导入依赖的package包/类
@Override
protected boolean isSavingEnabled(Project destProject, IDecisionVariable var) {
    // avoid that all imported config is saved over and over again
    // role separation
    boolean enabled;
    AbstractVariable decl = var.getDeclaration();
    IDatatype type = decl.getType();
    // QualiMaster convention
    if (ConstraintType.isConstraint(type)) {
        enabled = false;
    } else if (var.getParent() instanceof Configuration) {
        String decisionNamespace = var.getDeclaration().getNameSpace();
        String dstProjectNamespace = destProject.getName();
        enabled = dstProjectNamespace.equals(decisionNamespace);

        if (!enabled && dstProjectNamespace.endsWith(QmConstants.CFG_POSTFIX)) {
            String defProjectNamespace = dstProjectNamespace.substring(0, 
                dstProjectNamespace.length() - QmConstants.CFG_POSTFIX.length());
            enabled = defProjectNamespace.equals(decisionNamespace);
        }
    } else {
        enabled = true;
    }
    return enabled;
}
 
开发者ID:QualiMaster,项目名称:QM-EASyProducer,代码行数:26,代码来源:QualiMasterConfigurationSaver.java

示例8: obtainPipeline

import net.ssehub.easy.varModel.model.AbstractVariable; //导入依赖的package包/类
/**
 * Returns the pipeline decision for the given pipeline <code>element</code>.
 * 
 * @param configuration the configuration for the lookup
 * @param element the pipeline element (may be <b>null</b>, leads to <b>null</b>)
 * @return the pipeline, may be <b>null</b> if the pipeline was not found
 * @throws ModelQueryException if accessing type information fails
 */
@Invisible
public static IDecisionVariable obtainPipeline(net.ssehub.easy.varModel.confModel.Configuration configuration, 
    IDecisionVariable element) throws ModelQueryException {
    IDecisionVariable result = null;
    if (null != element) {
        AbstractVariable elementDecl = element.getDeclaration();
        IDatatype elementType = elementDecl.getType();
        IModelElement par = elementDecl.getTopLevelParent();
        if (par instanceof Project) {
            Project prj = (Project) par;
            IDatatype pipelineElementType = ModelQuery.findType(prj, QmConstants.TYPE_PIPELINE_ELEMENT, null);
            if (null != pipelineElementType && pipelineElementType.isAssignableFrom(elementType)) {
                IDatatype pipelineType = ModelQuery.findType(prj, QmConstants.TYPE_PIPELINE, null);
                if (null != pipelineType) {
                    result = searchScope(configuration, prj, pipelineType);
                }
            }
        }
    }
    return result;
}
 
开发者ID:QualiMaster,项目名称:QM-EASyProducer,代码行数:30,代码来源:PipelineHelper.java

示例9: obtainPipelineByName

import net.ssehub.easy.varModel.model.AbstractVariable; //导入依赖的package包/类
/**
 * Returns a pipeline from the configuration from a given variable containing pipelines.
 * 
 * @param config the configuration
 * @param name the name of the pipeline
 * @param varName the variable containing the pipelines
 * @return the pipeline or <b>null</b> if it does not exist
 */
@QMInternal
public static IDecisionVariable obtainPipelineByName(net.ssehub.easy.varModel.confModel.Configuration config, 
    String name, String varName) {
    IDecisionVariable result = null;
    try {
        AbstractVariable pips = ModelQuery.findVariable(config.getProject(), varName, null);
        IDecisionVariable pipsVar = config.getDecision(pips);
        if (null != pipsVar) {
            for (int n = 0; null == result && n < pipsVar.getNestedElementsCount(); n++) {
                IDecisionVariable pip = net.ssehub.easy.varModel.confModel.Configuration.dereference(
                    pipsVar.getNestedElement(n));
                if (VariableHelper.hasName(pip, name)) {
                    result = pip;
                }
            }
        }
    } catch (ModelQueryException e) {
            // -> result = null
    }
    return result;
}
 
开发者ID:QualiMaster,项目名称:QM-EASyProducer,代码行数:30,代码来源:PipelineHelper.java

示例10: obtainAlgorithmByName

import net.ssehub.easy.varModel.model.AbstractVariable; //导入依赖的package包/类
/**
 * Obtains an algorithm from <code>config</code> by its name.
 * 
 * @param config the configuration
 * @param name the name of the algorithm
 * @return the algorithm or <b>null</b> if not found
 */
@QMInternal
public static IDecisionVariable obtainAlgorithmByName(net.ssehub.easy.varModel.confModel.Configuration config, 
    String name) {
    IDecisionVariable result = null;
    try {
        AbstractVariable algVarDecl = ModelQuery.findVariable(
            config.getProject(), QmConstants.VAR_ALGORITHMS_ALGORITHMS, null);
        if (null != algVarDecl) {
            IDecisionVariable algs = config.getDecision(algVarDecl);
            if (null != algs) {
                for (int n = 0; null == result && n < algs.getNestedElementsCount(); n++) {
                    IDecisionVariable nested = net.ssehub.easy.varModel.confModel.Configuration.dereference(
                        algs.getNestedElement(n));
                    if (VariableHelper.hasName(nested, name)) {
                        result = nested;
                    }
                }
            }
        }
    } catch (ModelQueryException e) {
        // -> result = null
    }
    return result;
}
 
开发者ID:QualiMaster,项目名称:QM-EASyProducer,代码行数:32,代码来源:PipelineHelper.java

示例11: put

import net.ssehub.easy.varModel.model.AbstractVariable; //导入依赖的package包/类
/**
 * Puts the variables of project into <code>data</code> if they comply with <code>selector</code>.
 * 
 * @param project the project to be iterated over
 * @param data the data to be modified as a side effect (fqn-instance mapping)
 * @param cfg the underlying IVML configuration
 * @param selector the selector instance
 */
private void put(Project project, Map<String, IDecisionVariable> data, 
    net.ssehub.easy.varModel.confModel.Configuration cfg, IVariableSelector selector) {
    for (int i = 0; i < project.getImportsCount(); i++) {
        ProjectImport imp = project.getImport(i);
        if (null != imp.getResolved()) {
            put(imp.getResolved(), data, cfg, selector);
        }
    }
    for (int e = 0; e < project.getElementCount(); e++) {
        ContainableModelElement elt = project.getElement(e);
        if (elt instanceof AbstractVariable) {
            IDecisionVariable var = cfg.getDecision((AbstractVariable) elt);
            if (null != var && AssignmentState.FROZEN == var.getState() && selector.select(var)) {
                data.put(var.getDeclaration().getQualifiedName(), var);
            }
        }
    }
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:27,代码来源:ConfigurationTests.java

示例12: collectReferences

import net.ssehub.easy.varModel.model.AbstractVariable; //导入依赖的package包/类
/**
 * Collects the references for a single variable.
 * 
 * @param var the variable to collect the references for
 * @param references the references in terms of a reference target - referring elements maps (modified as a side 
 *     effect)
 */
private void collectReferences(IDecisionVariable var, Map<AbstractVariable, List<IDecisionVariable>> references) {
    IDatatype type = var.getDeclaration().getType();
    if (Reference.TYPE.isAssignableFrom(type)) {
        collectReference(var, var.getValue(), references);
    } else if (Container.TYPE.isAssignableFrom(type)) {
        Value value = var.getValue();
        if (value instanceof ContainerValue) { // NULLVALUE
            ContainerValue val = (ContainerValue) value;
            if (null != val) {
                for (int e = 0; e < val.getElementSize(); e++) {
                    collectReference(var, val.getElement(e), references);
                }
            }
        }
    }
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:24,代码来源:ConfigurationContextResolver.java

示例13: dereference

import net.ssehub.easy.varModel.model.AbstractVariable; //导入依赖的package包/类
/**
 * Dereferences a variable.
 * 
 * @param var the variable to be dereferenced (may be <b>null</b>)
 * @return the dereferenced variable (<b>null</b> if <code>var</code> was <b>null</b>)
 */
public static IDecisionVariable dereference(IDecisionVariable var) {
    if (null != var) {
        IDatatype type = var.getDeclaration().getType();
        while (type instanceof Reference) {
            type = ((Reference) type).getType();
            Value value = var.getValue();
            if (null != value && value != NullValue.INSTANCE) {
                AbstractVariable refDecl = ((ReferenceValue) var.getValue()).getValue();
                if (null != refDecl) {
                    var = var.getConfiguration().getDecision(refDecl);
                } // TODO valueEx
            } else {
                break;
            }
        }
    }
    return var;
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:25,代码来源:Configuration.java

示例14: printFailedElements

import net.ssehub.easy.varModel.model.AbstractVariable; //导入依赖的package包/类
/**
 * Method for displaying failed constraints and assignments.
 * 
 * @param failedElements the failed elements
 */
static void printFailedElements(FailedElements failedElements) {
    if (failedElements.hasProblems()) {
        if (failedElements.problemConstraintCount() > 0) {
            Iterator<Constraint> failedConstraints = failedElements.getProblemConstraints();
            while (failedConstraints.hasNext()) {
                Constraint failedRule = failedConstraints.next();
                LOGGER.debug("Failed constraint: " + toIvmlString(failedRule));
            }
        }
        if (failedElements.problemVariabletCount() > 0) {
            Iterator<AbstractVariable> failedVariables = failedElements.getProblemVariables();
            while (failedVariables.hasNext()) {
                AbstractVariable failedVariable = failedVariables.next();
                LOGGER.debug("Failed variable: " + failedVariable);
            } 
        }           
    } 
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:24,代码来源:ReasoningUtils.java

示例15: visitCompoundAccess

import net.ssehub.easy.varModel.model.AbstractVariable; //导入依赖的package包/类
@Override
public void visitCompoundAccess(CompoundAccess access) {
    context.compoundDown();
    access.getCompoundExpression().accept(this);
    AbstractVariable slotDecl = access.getResolvedSlot();
    if (null != slotDecl && context.hasParent()) {
        String nestedVar = getSlotOfCompound(access.getResolvedSlot());
        if (null != nestedVar) {
            context.elementFound();
            varContainer.setImportance(nestedVar, Importance.MANDATORY);
            if (context.depth() > 1) {
                context.addParent(nestedVar);
            }
        }
    }
    context.compoundUp();
    if (0 == context.depth()) {
        context.clear();
    }
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:21,代码来源:MandatoryDeclarationClassifier.java


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