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


Java Project.getImportsCount方法代码示例

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


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

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

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

示例3: addOperations

import net.ssehub.easy.varModel.model.Project; //导入方法依赖的package包/类
/**
 * Adds all operations of <code>project</code> and its imports to <code>operations</code>.
 * 
 * @param operations the name-operation mapping to be filled as a side effect
 * @param fields the name-field mapping to be filled as a side effect
 * @param project the project the operations shall be added for
 * @param done already done projects
 */
private void addOperations(Map<String, OperationDescriptor> operations, Map<String, FieldDescriptor> fields, 
    Project project, Set<Project> done) {
    if (!done.contains(project)) {
        done.add(project);
        int eCount = project.getElementCount();
        for (int e = 0; e < eCount; e++) {
            ContainableModelElement elt = project.getElement(e);
            if (elt instanceof DecisionVariableDeclaration) {
                addOperations((DecisionVariableDeclaration) elt, operations, fields);
            } else if (elt instanceof AttributeAssignment) {
                addOperations((AttributeAssignment) elt, operations, fields);
            }
        }
        for (int i = 0; i < project.getImportsCount(); i++) {
            Project imp = project.getImport(i).getResolved();
            if (null != imp) {
                addOperations(operations, fields, imp, done);
            }
        }
    }
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:30,代码来源:IvmlProjectTypeDescriptor.java

示例4: compare

import net.ssehub.easy.varModel.model.Project; //导入方法依赖的package包/类
/**
 * Recursive method for comparing the modified project with the expected project. 
 * @param actual The modified project (which was changed by the {@link ProjectRewriteVisitor}).
 * @param expected The expected project, loaded from {@link #expectedModelDir}.
 * @param done The list of already tested modified projects, should be empty when called from outside.
 */
private void compare(Project actual, Project expected, Set<Project> done) {
    if (!done.contains(actual)) {
        done.add(actual);
  
        // Compare String version of projects
        Assert.assertEquals("Project \"" + actual.getName() + "\" is not as expected:\n", toString(expected),
            toString(actual));
        
        // Continue with imported projects
        for (int i = 0; i < actual.getImportsCount(); i++) {
            // Imports of expected should be in same order as in actual
            compare(actual.getImport(i).getResolved(), expected.getImport(i).getResolved(), done);
        }
    }
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:22,代码来源:DynamicFreezeTest.java

示例5: visitProject

import net.ssehub.easy.varModel.model.Project; //导入方法依赖的package包/类
@Override
public void visitProject(Project project) {
    if (!done.contains(project)) {
        done.add(project);
        // local variables take precedence over imports
        for (int e = 0; e < project.getElementCount(); e++) {
            project.getElement(e).accept(this);
        }
        for (int i = 0; i < project.getImportsCount(); i++) {
            ProjectImport imp = project.getImport(i);
            String name = imp.getName();
            if (null != imp.getInterfaceName()) {
                name = name + IvmlKeyWords.NAMESPACE_SEPARATOR + imp.getInterfaceName();
            }
            imports.put(name, i);
            if (null != imp.getResolved()) {
                imp.getResolved().accept(this);
            }
        }
    }
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:22,代码来源:VariableUsage.java

示例6: assertImported

import net.ssehub.easy.varModel.model.Project; //导入方法依赖的package包/类
/**
 * Recursively asserts the resolved instances of model imports.
 * @param project the project to visit
 * @param imported the already imported (and visited) projects
 */
private static void assertImported(Project project, Map<ModelInfo<Project>, Project> imported) {
    for (int i = 0; i < project.getImportsCount(); i++) {
        ProjectImport imp = project.getImport(i);
        Project resolved = imp.getResolved();
        Assert.assertNotNull("import '" + imp.getName() + "' in '" + project.getName() + "' is not resolved", 
            resolved);
        ModelInfo<Project> info = VarModel.INSTANCE.availableModels().getModelInfo(resolved);
        Assert.assertNotNull("no model info for '" + imp.getName() + "'", info);
        if (imported.containsKey(info)) {
            Assert.assertTrue("only one instance of '" + imp.getName() + "' shall be used in the model references", 
                resolved == imported.get(info));
            // already visited, no recursion
        } else {
            imported.put(info, imp.getResolved());
            assertImported(imp.getResolved(), imported);
        }
    }
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:24,代码来源:ImportTest.java

示例7: createModelContent

import net.ssehub.easy.varModel.model.Project; //导入方法依赖的package包/类
/**
 * Creates the model content based on the given <code>project</code>.
 * 
 * @param project the IVML project instance
 */
private void createModelContent(Project project) {
    if (null != project) {
        int elementCount = project.getElementCount();
        for (int c = 0; c < elementCount; c++) {
            collect(project.getElement(c));
        }
        int importCount = project.getImportsCount();
        if (importCount > 0) {
            for (int i = 0; i < importCount; i++) {
                System.err.println("imports found!");
                resolveImports(project.getImport(i));
            }
        }
    }
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:21,代码来源:Model.java

示例8: searchSequenceValue

import net.ssehub.easy.varModel.model.Project; //导入方法依赖的package包/类
/**
 * Searches the given <code>project</code> for a sequence that contains <code>value</code> and returns the sequence
 * index access expression if successful. This method shall not be called directly. Use 
 * {@link #searchSequenceValue(Project, Value, Configuration)} instead.
 * 
 * @param project the project to start searching
 * @param value the value to be used as reference
 * @param config the actual configuration
 * @param done all the projects that have been searched so far
 * @return the access expression or <b>null</b> if none can be created
 */
private ConstraintSyntaxTree searchSequenceValue(Project project, Value value, Configuration config, 
    Set<Object> done) {
    ConstraintSyntaxTree result = null;
    if (!done.contains(project)) {
        done.add(project);
        IDatatype valueType = value.getType();
        // search for a sequence that has the value type as generic type, try to access the value
        // and if this works, create a index access expression
        for (int e = 0; e < project.getElementCount(); e++) {
            ContainableModelElement elt = project.getElement(e);
            if (elt instanceof DecisionVariableDeclaration) {
                DecisionVariableDeclaration decl = (DecisionVariableDeclaration) elt;
                IDatatype declType = decl.getType();
                if (Sequence.isSequence(declType, valueType)) {
                    IDecisionVariable candidateVar = config.getDecision(decl);
                    result = createIndexAccess(decl, candidateVar.getValue(), value);
                }
            }
        }
        // if not found, search in related projects
        if (null == result) {
            for (int i = 0; null == result && i < project.getImportsCount(); i++) {
                Project imp = project.getImport(i).getResolved();
                if (null != imp) {
                    result = searchSequenceValue(imp, value, config, done);
                }
            }
        }
    }
    return result;
}
 
开发者ID:QualiMaster,项目名称:QM-EASyProducer,代码行数:43,代码来源:QualiMasterConfigurationSaver.java

示例9: getBindingTimeAnnotation

import net.ssehub.easy.varModel.model.Project; //导入方法依赖的package包/类
/**
 * Returns the binding time annotation of the project to create the selector statement of the freeze block.
 * @param project The project for which the freeze block shall be created.
 * @return The binding time annotation or <tt>null</tt> it could not be found.
 */
private Attribute getBindingTimeAnnotation(Project project) {
    Attribute btAnnotation = project.getAttribute(QmConstants.ANNOTATION_BINDING_TIME);
    
    // Try to build up the cache
    if (null == btAnnotation && project.getName().endsWith(QmConstants.CFG_POSTFIX)) {
        String baseName = project.getName().substring(0, project.getName().length()
            - QmConstants.CFG_POSTFIX.length());
        Project baseProject = usedProjects.get(baseName);
        if (null == baseProject) {
            for (int i = 0, end = project.getImportsCount(); i < end && null == baseProject; i++) {
                Project importedProject = project.getImport(i).getResolved();
                String importedName = importedProject.getName();
                
                if (!usedProjects.containsKey(importedName)) {
                    usedProjects.put(importedName, importedProject);
                }
                
                if (baseName.equals(importedName)) {
                    baseProject = importedProject;
                }
            }
        }
        
        if (null != baseProject) {
            for (int i = 0, end = baseProject.getAttributesCount(); i < end && btAnnotation == null; i++) {
                btAnnotation = baseProject.getAttribute(QmConstants.ANNOTATION_BINDING_TIME);
            }
        }
    }
    
    return btAnnotation;
}
 
开发者ID:QualiMaster,项目名称:QM-EASyProducer,代码行数:38,代码来源:ProjectFreezeModifier.java

示例10: visitProject

import net.ssehub.easy.varModel.model.Project; //导入方法依赖的package包/类
@Override
public void visitProject(Project project) {
    for (int i = 0; i < project.getImportsCount(); i++) {
        project.getImport(i).accept(this);
    }
    for (int e = 0; e < project.getElementCount(); e++) {
        project.getElement(e).accept(this);
    }
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:10,代码来源:TestVisitor.java

示例11: visitProject

import net.ssehub.easy.varModel.model.Project; //导入方法依赖的package包/类
@Override
public void visitProject(Project project) {
    for (int i = 0; i < project.getImportsCount(); i++) {
        project.getImport(i).accept(this);
    }
    int eSize = project.getElementCount();
    for (int e = 0; e < eSize; e++) {
        project.getElement(e).accept(this);
    }
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:11,代码来源:VariableCollector.java

示例12: findAttribute

import net.ssehub.easy.varModel.model.Project; //导入方法依赖的package包/类
/**
 * Finds a declaration for the attribute <code>name</code> in <code>prj</code> or it's imports.
 * 
 * @param prj the project to search for
 * @param name the name of the attribute
 * @param done the already processed projects (cycle detection)
 * @return the found attribute (may be <b>null</b>)
 */
private Attribute findAttribute(Project prj, String name, Set<Project> done) {
    Attribute result = null;
    if (!done.contains(prj)) {
        done.add(prj);
        result = prj.getAttribute(name);
        for (int i = 0; null == result && i < prj.getImportsCount(); i++) {
            Project p = prj.getImport(i).getResolved();
            if (null != p) {
                result = findAttribute(p, name, done);
            }
        }
    }
    return result;
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:23,代码来源:VariableValueCopier.java

示例13: assertProject

import net.ssehub.easy.varModel.model.Project; //导入方法依赖的package包/类
/**
 * Tests the copies projects (and its imports).
 * @param original The original for comparison.
 * @param copy The copied project to test.
 * @param done Already checked copied projects (to avoid cycles).
 */
private void assertProject(Project original, Project copy, java.util.Set<Project> done) {
    Assert.assertNotNull("Copy is null", copy);

    if (!done.contains(copy)) {
        done.add(copy);
        
        // Test project
        Assert.assertEquals("Copied project does not have the same name", original.getName(), copy.getName());
        Assert.assertNotSame("Projects \"" + original.getName() + "\"are same, i.e., no copy was created",
            original, copy);
        Assert.assertTrue("Copied project has not the same Version",
            Version.equals(original.getVersion(), copy.getVersion()));
        Assert.assertEquals("Copied project does not have the same amount of imports", original.getImportsCount(),
            copy.getImportsCount());
        Assert.assertEquals("Copied project has not the same amount of elements", original.getElementCount(),
            copy.getElementCount());
        
        // Test imports
        Assert.assertEquals("Copy has different amount of imports", original.getImportsCount(),
            copy.getImportsCount());
        for (int i = 0; i < original.getImportsCount(); i++) {
            ProjectImport orgImport = original.getImport(i);
            ProjectImport copyImport = copy.getImport(i);
            Assert.assertNotSame("Original import[" + i + "] was used instead of copy for import of \""
                + copyImport.getName() + "\"", orgImport, copyImport);
            Assert.assertEquals("Import[" + i + "] name is wrong", orgImport.getName(), copyImport.getName());
            // TODO SE: Version restriction
            Assert.assertEquals("Interface[" + i + "] name is wrong", orgImport.getInterfaceName(),
                copyImport.getInterfaceName());
            assertProject(orgImport.getResolved(), copyImport.getResolved(), done);
        }
        
        // Test annotations
        assertAnnotateableElement(original, copy, copy);
    }
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:43,代码来源:ProjectCopyVisitorTest.java

示例14: checkForDispatch

import net.ssehub.easy.varModel.model.Project; //导入方法依赖的package包/类
/**
 * Checks the given scope for dispatch candidates.
 * 
 * @param scope the scope to check for
 */
void checkForDispatch(Project scope) {
    if (!doneProjects.contains(scope)) {
        doneProjects.add(scope);
        for (int o = 0, n = scope.getOperationCount(); bestDiff > 0 && o < n; o++) {
            CustomOperation tmp = scope.getOperation(o);
            if (tmp != operation && opName.equals(tmp.getName()) && opParamCount == tmp.getParameterCount()) {
                String tmpSignature = tmp.getSignature();
                if (!candidates.contains(tmpSignature)) {
                    int diff = EvaluationUtils.calculateDiff(tmp, returnType, argTypes);
                    if (diff < 0) {
                        continue;
                    }
                    candidates.add(tmpSignature);
                    if (diff < bestDiff) {
                        bestMatch = tmp;
                        bestDiff = diff;
                    }
                }
            }
        }
        for (int i = 0, n = scope.getImportsCount(); bestDiff > 0 && i < n; i++) {
            Project imp = scope.getImport(i).getResolved();
            if (null != imp) {
                checkForDispatch(imp);
            }
        }
    }
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:34,代码来源:DispatchInformation.java

示例15: visitProject

import net.ssehub.easy.varModel.model.Project; //导入方法依赖的package包/类
@Override
public void visitProject(Project project) {
    if (considerImports) {
        for (int i = 0; i < project.getImportsCount(); i++) {
            project.getImport(i).accept(this);
        }
    }
    for (int i = 0; i < project.getElementCount(); i++) {
        project.getElement(i).accept(this);
    }     
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:12,代码来源:ConstraintFinder.java


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