當前位置: 首頁>>代碼示例>>Java>>正文


Java ModelRepository.destroyCurrentWorkspace方法代碼示例

本文整理匯總了Java中fr.lip6.move.pnml.framework.utils.ModelRepository.destroyCurrentWorkspace方法的典型用法代碼示例。如果您正苦於以下問題:Java ModelRepository.destroyCurrentWorkspace方法的具體用法?Java ModelRepository.destroyCurrentWorkspace怎麽用?Java ModelRepository.destroyCurrentWorkspace使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在fr.lip6.move.pnml.framework.utils.ModelRepository的用法示例。


在下文中一共展示了ModelRepository.destroyCurrentWorkspace方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: fuseDocuments

import fr.lip6.move.pnml.framework.utils.ModelRepository; //導入方法依賴的package包/類
/**
 * Fuse documents of two given workspace in one. All net of second document
 * will now belong in first one.
 *
 * @param WsId1
 *            id of first Document Workspace
 * @param WsId2
 *            id of second Document Workspace
 * @throws InvalidIDException
 *             if an unexisting workspace is given or if duplicated id
 *             exists between the two workspaces
 * @throws VoidRepositoryException
 *             if Model repository has not been initializated.
 * @throws OtherException
 *             if a problem occure with classes
 */
public static void fuseDocuments(String WsId1, String WsId2)
        throws InvalidIDException, VoidRepositoryException, OtherException {
    PetriNetDocHLAPI doc1;
    PetriNetDocHLAPI doc2;
    IdRepository idr1;
    IdRepository idr2;

    ModelRepository mr = ModelRepository.getInstance();
    mr.changeCurrentDocWorkspace(WsId1);
    if (mr.getCurrentHLAPIRootClass() !=null && mr.getCurrentHLAPIRootClass().getClass().equals(
            PetriNetDocHLAPI.class)) {
        doc1 = (PetriNetDocHLAPI) mr.getCurrentHLAPIRootClass();
        idr1 = mr.getCurrentIdRepository();
    } else {
        throw new OtherException(
                "The HLAPIRootClass is not of the expected type");
    }

    mr.changeCurrentDocWorkspace(WsId2);
    if (mr.getCurrentHLAPIRootClass() !=null && mr.getCurrentHLAPIRootClass().getClass().equals(
            PetriNetDocHLAPI.class)) {
        doc2 = (PetriNetDocHLAPI) mr.getCurrentHLAPIRootClass();
        idr2 = mr.getCurrentIdRepository();
    } else {
        throw new OtherException(
                "The HLAPIRootClass is not of the expected type");
    }

    mr.changeCurrentDocWorkspace(WsId1);
    if (!idr1.isCompatible(idr2))
        throw new InvalidIDException(
                "Common ids exists between the two workspaces");

    for (PetriNetHLAPI net : doc2.getNetsHLAPI()) {
        doc1.addNetsHLAPI(net);
    }
    idr1.fuseWith(idr2);
    mr.changeCurrentDocWorkspace(WsId2);
    mr.destroyCurrentWorkspace();
    mr.changeCurrentDocWorkspace(WsId1);
}
 
開發者ID:lip6,項目名稱:pnmlframework,代碼行數:58,代碼來源:Tools.java


注:本文中的fr.lip6.move.pnml.framework.utils.ModelRepository.destroyCurrentWorkspace方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。