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


Java Project类代码示例

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


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

示例1: getAlgorithmParameters

import net.ssehub.easy.varModel.model.Project; //导入依赖的package包/类
@Override
public Map<String, List<AlgorithmParameter>> getAlgorithmParameters() {
    if (null == parameter) {
        Models models = RepositoryConnector.getModels(Phase.MONITORING);
        if (null == config && null != models) {
            models.startUsing();
            config = models.getConfiguration();
            if (null != config) {
                Project prj = config.getProject();
                try {
                    // ok as long as the model is not changing - then clear variables...
                    algorithms = ModelQuery.findVariable(prj, "algorithms", null); 
                } catch (ModelQueryException e) {
                    LogManager.getLogger(Tracing.class).error("cannot find 'algorithms'", e);
                }
            }
            models.endUsing();
        }
        if (null != config && null != algorithms) {
            parameter = collectAlgorithmParameters(config, algorithms);
        }
    }
    return parameter;
}
 
开发者ID:QualiMaster,项目名称:Infrastructure,代码行数:25,代码来源:TracingTask.java

示例2: checkProviderUpdate

import net.ssehub.easy.varModel.model.Project; //导入依赖的package包/类
/**
 * Checks for updates of the models in the provider.
 */
private void checkProviderUpdate() {
    provider.startUsing();
    Configuration cfg = provider.getConfiguration();
    if (cfg != config) { // checking for config is sufficient 
        this.config = cfg;
        this.rtVilModel = provider.getScript();
        this.variableMapping = provider.getVariableMapping();
        
        Project prj = this.config.getProject();
        typePipeline = findDatatype(prj, QmConstants.TYPE_PIPELINE);
        typePipelineElement = findDatatype(prj, QmConstants.TYPE_PIPELINE_ELEMENT);
        typeMachine = findDatatype(prj, QmConstants.TYPE_MACHINE);
        typeHwNode = findDatatype(prj, QmConstants.TYPE_HWNODE);
        typeAlgorithm = findDatatype(prj, QmConstants.TYPE_ALGORITHM);            
    }
    provider.endUsing();
}
 
开发者ID:QualiMaster,项目名称:Infrastructure,代码行数:21,代码来源:ReasoningTask.java

示例3: reloadIvml

import net.ssehub.easy.varModel.model.Project; //导入依赖的package包/类
/**
 * Forces that IVML-related models are reloaded. Call {@link #startUsing()} before.
 */
public void reloadIvml() {
    VarModel.INSTANCE.outdateAll();
    if (null != configuration) {
        Project oldProject = configuration.getProject();
        Project newProject = VarModel.INSTANCE.reload(oldProject, true);
        
        if (oldProject == newProject) {
            LogManager.getLogger(RepositoryConnector.class).error("IVML model " + oldProject.getName()
                + " was not reloaded.");
        }
        
        configuration = createConfiguration(newProject, phase);
        try {
            variableMapping = ConfigurationInitializer.createVariableMapping(configuration);
        } catch (ModelQueryException e) {
            LogManager.getLogger(RepositoryConnector.class).error(e.getMessage(), e);
        }
    }
}
 
开发者ID:QualiMaster,项目名称:Infrastructure,代码行数:23,代码来源:RepositoryConnector.java

示例4: saveValues

import net.ssehub.easy.varModel.model.Project; //导入依赖的package包/类
/**
 * Saves the values of configuration projects(recursive function).
 * @param project The copied QM model (the starting point, which imports all the other models).
 * @param done The list of already saved projects, should be empty at the beginning.
 */
private void saveValues(Project project, Set<Project> done) {
    if (!done.contains(project)) {
        done.add(project);
        
        if (project.getName().endsWith(QmConstants.CFG_POSTFIX)) {
            Bundle.getLogger(ModelModifier.class).debug("Saving ", project.getName());
            try {
                Configuration tmpConfig = new Configuration(project, true);
                // Will change the underlying Project as a side effect
                new QmPrunedConfigSaver(tmpConfig);
            } catch (ConfigurationException e1) {
                Bundle.getLogger(ModelModifier.class).exception(e1);
            }
        }
        
        for (int i = 0, end = project.getImportsCount(); i < end; i++) {
            saveValues(project.getImport(i).getResolved(), done);
        }
    }
}
 
开发者ID:QualiMaster,项目名称:QM-EASyProducer,代码行数:26,代码来源:ModelModifier.java

示例5: freezeProject

import net.ssehub.easy.varModel.model.Project; //导入依赖的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

示例6: modifyImports

import net.ssehub.easy.varModel.model.Project; //导入依赖的package包/类
/**
 * Modifies the imports in the main pipeline project <code>mainProject</code>.
 * 
 * @param mainProject
 *            the project to be modified
 * @param command
 *            the command how to modify the project, <code>ADD</code> or <code>DEL</code>
 * @param pImport
 *            the import to be added or deleted
 * @return <code>True</code> if modify successfully, <code>false</code> otherwise
 */
public static boolean modifyImports(Project mainProject, String command, ProjectImport pImport) {
    boolean modified = false;
    switch (command) {
    case ADD: {
        modified = mainProject.addImport(pImport); // it will also check if the import existed before add
        break;
    }
    case DEL: {
        modified = mainProject.removeImport(pImport); // it will also check if the import existed before delete
        break;
    }
    default: {
        break;
    }
    }
    return modified;

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

示例7: createAssignmentConstraint

import net.ssehub.easy.varModel.model.Project; //导入依赖的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

示例8: isSavingEnabled

import net.ssehub.easy.varModel.model.Project; //导入依赖的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

示例9: createVariableMapping

import net.ssehub.easy.varModel.model.Project; //导入依赖的package包/类
/**
 * Creates a runtime variable mapping for <code>configuration</code>.
 * 
 * @param config the configuration
 * @return the runtime variable mapping
 * @throws ModelQueryException in case of problems accessing model elements
 */
@Invisible
public static RuntimeVariableMapping createVariableMapping(
    net.ssehub.easy.varModel.confModel.Configuration config) throws ModelQueryException {
    Project project = config.getProject();
    Compound sourceType = findCompound(project, TYPE_SOURCE);
    Compound familyElementType = findCompound(project, TYPE_FAMILYELEMENT);
    Compound sinkType = findCompound(project, TYPE_SINK);
    RuntimeVariableMapping result = new RuntimeVariableMapping();
    Iterator<IDecisionVariable> iter = config.iterator();
    while (iter.hasNext()) {
        IDecisionVariable var = iter.next();
        IDatatype type = var.getDeclaration().getType();
        if (sourceType.isAssignableFrom(type) || sinkType.isAssignableFrom(type)
            || familyElementType.isAssignableFrom(type)) {
            addVariableMapping(var, SLOT_AVAILABLE, result);
        }
    }
    return result;
}
 
开发者ID:QualiMaster,项目名称:QM-EASyProducer,代码行数:27,代码来源:ConfigurationInitializer.java

示例10: addTopLevelValues

import net.ssehub.easy.varModel.model.Project; //导入依赖的package包/类
/**
 * Adds top level values configured for <code>source</code> to <code>target</code>.
 * 
 * @param cfg the actual configuration holding the values
 * @param source the source project
 * @param target the target project
 * @param exclude the variable names to exclude
 * @return the changed top-level variables ready for freezing
 * @throws CSTSemanticException in case of CST errors
 */
private static List<IFreezable> addTopLevelValues(Configuration cfg, Project source, Project target, 
    String... exclude) throws CSTSemanticException {
    List<IFreezable> result = new ArrayList<IFreezable>();
    for (int e = 0; e < source.getElementCount(); e++) {
        ContainableModelElement elt = source.getElement(e);
        if (elt instanceof DecisionVariableDeclaration) {
            DecisionVariableDeclaration decl = (DecisionVariableDeclaration) elt;
            if (!Arrays.contains(exclude, decl.getName())) {
                IDecisionVariable decVar = cfg.getDecision(decl);
                Value value = decVar.getValue();
                if (null != value && !ConstraintType.isConstraint(decVar.getDeclaration().getType())) {
                    ConstraintSyntaxTree cst = new OCLFeatureCall(new Variable(decl), IvmlKeyWords.ASSIGNMENT, 
                        new ConstantValue(decVar.getValue().clone()));
                    cst.inferDatatype();
                    Constraint constraint = new Constraint(cst, target);
                    target.addConstraint(constraint);
                    result.add(decl);
                }
            }
        }
    }
    return result;
}
 
开发者ID:QualiMaster,项目名称:QM-EASyProducer,代码行数:34,代码来源:AlgorithmProfileHelper.java

示例11: setPipelines

import net.ssehub.easy.varModel.model.Project; //导入依赖的package包/类
/**
 * Sets the given <code>pipeline</code> as value in the <code>varName</code> of <code>prj</code>. 
 *
 * @param prj the project to modify
 * @param varName the variable to modify
 * @param pipeline the pipeline to set as (reference) value
 * @return the affected variable
 * @throws ModelQueryException if access to the variable failed
 * @throws CSTSemanticException in case of CST errors
 * @throws ValueDoesNotMatchTypeException if <code>pipeline</code> does not match as a value
 */
private static DecisionVariableDeclaration setPipelines(Project prj, String varName, 
    DecisionVariableDeclaration pipeline) throws ModelQueryException, CSTSemanticException, 
    ValueDoesNotMatchTypeException {
    DecisionVariableDeclaration pipelinesVar = (DecisionVariableDeclaration) ModelQuery.findVariable(prj, 
        varName, DecisionVariableDeclaration.class);
    if (null != pipelinesVar && pipelinesVar.getType() instanceof Container) {
        Container cType = (Container) pipelinesVar.getType();
        ConstraintSyntaxTree cst = new OCLFeatureCall(new Variable(pipelinesVar), IvmlKeyWords.ASSIGNMENT, 
            new ConstantValue(ValueFactory.createValue(cType, pipeline)));
        cst.inferDatatype();
        Constraint constraint = new Constraint(cst, prj);
        prj.addConstraint(constraint);
    } else {
        throw new ModelQueryException("pipelines variable '" + varName + "' not found", 
            ModelQueryException.ACCESS_ERROR);            
    }
    return pipelinesVar;
}
 
开发者ID:QualiMaster,项目名称:QM-EASyProducer,代码行数:30,代码来源:AlgorithmProfileHelper.java

示例12: obtainPipeline

import net.ssehub.easy.varModel.model.Project; //导入依赖的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

示例13: createFreezeBlock

import net.ssehub.easy.varModel.model.Project; //导入依赖的package包/类
/**
 * Creates a freeze block for project. [legacy style, does not add to project]
 * 
 * @param freezables
 *            the freezables
 * @param project
 *            the IVML project to add to (may be <b>null</b> if failed)
 * @param fallbackForType
 *            in case that <code>project</code> is being written the first time, may be <b>null</b>
 * @return the created freeze block
 * @throws CSTSemanticException
 *             in case of CST errors
 * @throws ValueDoesNotMatchTypeException
 *             in case of unmatching values
 * @throws ModelQueryException
 *             in case of model access problems
 */
public static FreezeBlock createFreezeBlock(IFreezable[] freezables, Project project, Project fallbackForType)
        throws CSTSemanticException, ValueDoesNotMatchTypeException, ModelQueryException {
    FreezeBlock result = null;
    FreezeVariableType iterType = new FreezeVariableType(freezables, project);
    DecisionVariableDeclaration iter = new DecisionVariableDeclaration("f", iterType, project);
    net.ssehub.easy.varModel.model.datatypes.Enum type = ModelQuery.findEnum(project, TYPE_BINDING_TIME);
    if (null == type && null != fallbackForType) {
        type = ModelQuery.findEnum(fallbackForType, TYPE_BINDING_TIME);
    }
    String butOperation = "==";
    EnumLiteral literal = type.get(CONST_BINDING_TIME_RUNTIME);
    if (null == literal) { // newer version of the model
        literal = type.get(CONST_BINDING_TIME_RUNTIME_MON);
        butOperation = ">=";
    }
    ConstraintSyntaxTree runtime = new ConstantValue(ValueFactory.createValue(type, literal));
    Variable iterEx = new AttributeVariable(new Variable(iter), iterType.getAttribute(ANNOTATION_BINDING_TIME));
    OCLFeatureCall op = new OCLFeatureCall(iterEx, butOperation, runtime);
    op.inferDatatype();
    result = new FreezeBlock(freezables, iter, op, project);
    return result;
}
 
开发者ID:QualiMaster,项目名称:QM-EASyProducer,代码行数:40,代码来源:Utils.java

示例14: put

import net.ssehub.easy.varModel.model.Project; //导入依赖的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

示例15: resolveDefaultValues

import net.ssehub.easy.varModel.model.Project; //导入依赖的package包/类
/**
 * Part of the {@link #resolve()} method.
 * Resolves default values of variable declarations.
 * @param project The current project for which assignments shall be resolved.
 */
protected void resolveDefaultValues(Project project) {
    DeclarationFinder finder = new DeclarationFinder(project, FilterType.NO_IMPORTS, null);
    List<AbstractVariable> variables = finder.getVariableDeclarations(VisibilityType.ALL);
    boolean variablesResolved = true;
    int remainingSteps = iterationLoops > 0 ? iterationLoops : 1;
    
    while (variables.size() > 0 && variablesResolved && remainingSteps > 0) {
        List<AbstractVariable> unresolvedVariables = new ArrayList<AbstractVariable>();
        variablesResolved = false;
        
        for (AbstractVariable decl : variables) {
            if (!resolveDefaultValueForDeclaration(decl, config.getDecision(decl))) {
                unresolvedVariables.add(decl);
                variablesResolved = true;
            }
        }
        
        // Swap
        variables = unresolvedVariables;
        unresolvedVariables = new ArrayList<AbstractVariable>();
        remainingSteps--;
    }
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:29,代码来源:AssignmentResolver.java


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