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


Java ModelManagement.load方法代码示例

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


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

示例1: load

import net.ssehub.easy.basics.modelManagement.ModelManagement; //导入方法依赖的package包/类
/**
 * Loads the main model.
 * @param management Either {@link VarModel#INSTANCE} or {@link BuildModel#INSTANCE}
 * @param fileEnding Either <tt>.ivml</tt> or <tt>_0.vil</tt>.
 * @param <M> Either {@link Project} or {@link Script}.
 * @return The loaded model or <tt>null</tt> if it was not found.
 */
private <M extends IModel> M load(ModelManagement<M> management, String fileEnding) {
    M model = null;
    File file = new File(tempModelsFolder, QmConstants.PROJECT_TOP_LEVEL + fileEnding);
    URI vilURI = file.toURI();
    ModelInfo<M> info = management.availableModels().getModelInfo(QmConstants.PROJECT_TOP_LEVEL, new Version(0),
        vilURI);
        
    if (null != info) {
        try {
            model = management.load(info);
        } catch (ModelManagementException e) {
            Bundle.getLogger(ModelModifier.class).exception(e);
        }
    }
    
    return model;
}
 
开发者ID:QualiMaster,项目名称:QM-EASyProducer,代码行数:25,代码来源:ModelModifier.java

示例2: loadPreferredModel

import net.ssehub.easy.basics.modelManagement.ModelManagement; //导入方法依赖的package包/类
/**
 * Loads a model with the specified (model name, version) pair from the given {@link ModelManagement} instance.
 * The model will only be loaded, if it can be loaded from the given <tt>locations</tt>
 * (ordering of parameters will be considered).
 * 
 * @param modelMgmt The {@link ModelManagement} instance from where the {@link IModel} should be loaded from, i.e.
 *     {@link net.ssehub.easy.varModel.management.VarModel#INSTANCE}
 *     or {@link net.ssehub.easy.instantiation.core.model.buildlangModel.BuildModel#INSTANCE}.
 * @param modelDefinition A (model name, version) pair for specifying which {@link IModel} should be loaded.
 * @param locations A ordered list of locations from where the {@link IModel} should be loaded from.
 * @param <M> The specific model type, will be derived from the {@link ModelManagement} instance.
 *     Will be {@link net.ssehub.easy.varModel.model.Project}
 *     or {@link net.ssehub.easy.instantiation.core.model.buildlangModel.Script}.
 * @return A loaded {@link IModel} or <tt>null</tt>.
 * 
 * @throws ModelManagementException In case that the available information
 *     may become inconsistent due to this update
 */
static<M extends IModel> M loadPreferredModel(ModelManagement<M> modelMgmt,
    IModelData modelDefinition, File... locations) throws ModelManagementException {
    
    ModelInfo<M> result = null;
    List<ModelInfo<M>> infos = modelMgmt.availableModels().getModelInfo(modelDefinition.getName(),
        modelDefinition.getVersion());
    
    if (null != infos && infos.size() > 0 && null != locations && locations.length > 0) {
        for (int i = 0; i < locations.length && null == result; i++) {
            File currentFile = locations[i];
            URI currentURI = currentFile.toURI();
            for (int j = 0; j < infos.size() && null == result; j++) {
                ModelInfo<M> info = infos.get(j);
                if (info.isContainedIn(currentURI)) {
                    result = info;
                }
            }
        }
    }
    
    // Throws a ModelManagementException if result is null
    return modelMgmt.load(result);
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:42,代码来源:Utils.java

示例3: assertOutdated

import net.ssehub.easy.basics.modelManagement.ModelManagement; //导入方法依赖的package包/类
/**
 * Asserts the outdated functionality on a model management instance.
 * 
 * @param <R> model type
 * @param mgt the management instance
 * @param modelName the model name
 * @throws ModelManagementException in case that model loading fails
 */
protected <R extends IModel> void assertOutdated(ModelManagement<R> mgt, String modelName) 
    throws ModelManagementException {
    List<ModelInfo<R>> infos = mgt.availableModels().getModelInfo(modelName);
    Assert.assertTrue("model not found", !infos.isEmpty());
    R m0 = mgt.load(infos.get(0));
    Assert.assertFalse("model is outdated", mgt.isOutdated(m0));
    mgt.outdateAll();
    Assert.assertTrue("model is not outdated", mgt.isOutdated(m0));
    R m1 = mgt.load(infos.get(0));
    Assert.assertFalse("model is outdated", mgt.isOutdated(infos.get(0)));
    Assert.assertFalse("model is outdated", mgt.isOutdated(m1));
    Assert.assertTrue("model instances shall not be equal after setting outdated", m0 != m1);
    mgt.setOutdated(m1);
    Assert.assertTrue("model is not outdated", mgt.isOutdated(m1));
    R m2 = mgt.load(infos.get(0));
    Assert.assertTrue("model instances shall not be equal after setting outdated", m1 != m2);
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:26,代码来源:AbstractTest.java

示例4: loadModel

import net.ssehub.easy.basics.modelManagement.ModelManagement; //导入方法依赖的package包/类
/**
 * Loads an {@link IModel} from a file, i.e. a IVML project, a VIL script, or a VTL template.
 * This also adds the the parent folder of the file to {@link ModelManagement#locations()}.
 * @param modelManagement A {@link ModelManagement}, i.e. {@link VarModel#INSTANCE}, {@link BuildModel#INSTANCE},
 *     or {@link TemplateModel#INSTANCE}. Please be aware of that the correct model is used in respect to the
 *     desired file, which should be loaded by the model.
 * @param modelFile The model file which should be loaded, must be of the type of the used {@link ModelManagement}.
 * @param <M> The type handled by the given {@link ModelManagement}, i.e. {@link Project}, {@link Script},
 *     or {@link net.ssehub.easy.instantiation.core.model.templateModel.Template}
 * @return The loaded (and parsed) model.
 * @throws ModelManagementException In case of any error during loading the file.
 */
public static<M extends IModel> M loadModel(ModelManagement<M> modelManagement, File modelFile)
    throws ModelManagementException {
    
    modelManagement.locations().updateLocation(modelFile.getParentFile(), ProgressObserver.NO_OBSERVER);
    modelManagement.updateModelInformation(modelFile, ProgressObserver.NO_OBSERVER);
    ModelInfo<M> info = modelManagement.availableModels().getInfo(modelFile.toURI());
    return modelManagement.load(info);
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:21,代码来源:PersistenceUtils.java


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