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


Java BlockUml類代碼示例

本文整理匯總了Java中net.sourceforge.plantuml.BlockUml的典型用法代碼示例。如果您正苦於以下問題:Java BlockUml類的具體用法?Java BlockUml怎麽用?Java BlockUml使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: create

import net.sourceforge.plantuml.BlockUml; //導入依賴的package包/類
public static MDADiagram create(String uml) {
	List<BlockUml> blocks = new SourceStringReader(uml).getBlocks();
	if (blocks.size() == 0) {
		uml = "@startuml\n" + uml + "\[email protected]";
		blocks = new SourceStringReader(uml).getBlocks();
		if (blocks.size() == 0) {
			return null;
		}
	}
	final BlockUml block = blocks.get(0);
	final Diagram diagram = block.getDiagram();
	if (diagram instanceof ClassDiagram) {
		return new MDADiagramImpl((ClassDiagram) diagram);
	}
	return null;
}
 
開發者ID:Banno,項目名稱:sbt-plantuml-plugin,代碼行數:17,代碼來源:MDADiagramImpl.java

示例2: checkSyntaxFair

import net.sourceforge.plantuml.BlockUml; //導入依賴的package包/類
public static SyntaxResult checkSyntaxFair(String source) {
	final SyntaxResult result = new SyntaxResult();
	final SourceStringReader sourceStringReader = new SourceStringReader(new Defines(), source,
			Collections.<String> emptyList());

	final List<BlockUml> blocks = sourceStringReader.getBlocks();
	if (blocks.size() == 0) {
		result.setError(true);
		result.setErrorLinePosition(lastLineNumber(source));
		result.addErrorText("No @enduml found");
		result.setSuggest(Arrays.asList("Did you mean:", "@enduml"));
		return result;
	}

	final Diagram system = blocks.get(0).getDiagram();
	result.setCmapData(system.hasUrl());
	if (system instanceof UmlDiagram) {
		result.setUmlDiagramType(((UmlDiagram) system).getUmlDiagramType());
		result.setDescription(system.getDescription().getDescription());
	} else if (system instanceof PSystemError) {
		result.setError(true);
		final PSystemError sys = (PSystemError) system;
		result.setErrorLinePosition(sys.getHigherErrorPosition());
		result.setLineLocation(sys.getLineLocation());
		for (ErrorUml er : sys.getErrorsUml()) {
			result.addErrorText(er.getError());
		}
		result.setSystemError(sys);
		result.setSuggest(sys.getSuggest());
	} else {
		result.setDescription(system.getDescription().getDescription());
	}
	return result;
}
 
開發者ID:Banno,項目名稱:sbt-plantuml-plugin,代碼行數:35,代碼來源:SyntaxChecker.java

示例3: hasCMapData

import net.sourceforge.plantuml.BlockUml; //導入依賴的package包/類
public static boolean hasCMapData(String uml) {
	List<BlockUml> blocks = new SourceStringReader(uml).getBlocks();
	if (blocks.size() == 0) {
		uml = "@startuml\n" + uml + "\[email protected]";
		blocks = new SourceStringReader(uml).getBlocks();
		if (blocks.size() == 0) {
			return false;
		}
	}
	final BlockUml block = blocks.get(0);
	final Diagram diagram = block.getDiagram();
	return diagram.hasUrl();
}
 
開發者ID:Banno,項目名稱:sbt-plantuml-plugin,代碼行數:14,代碼來源:PlantumlUtils.java

示例4: checkSyntax

import net.sourceforge.plantuml.BlockUml; //導入依賴的package包/類
public static SyntaxResult checkSyntax(String source) {
	OptionFlags.getInstance().setQuiet(true);
	final SyntaxResult result = new SyntaxResult();

	if (source.startsWith("@startuml\n") == false) {
		result.setError(true);
		result.setErrorLinePosition(0);
		result.addErrorText("No @startuml found");
		result.setSuggest(Arrays.asList("Did you mean:", "@startuml"));
		return result;
	}
	if (source.endsWith("@enduml\n") == false && source.endsWith("@enduml") == false) {
		result.setError(true);
		result.setErrorLinePosition(lastLineNumber(source));
		result.addErrorText("No @enduml found");
		result.setSuggest(Arrays.asList("Did you mean:", "@enduml"));
		return result;
	}
	final SourceStringReader sourceStringReader = new SourceStringReader(new Defines(), source,
			Collections.<String> emptyList());

	final List<BlockUml> blocks = sourceStringReader.getBlocks();
	if (blocks.size() == 0) {
		result.setError(true);
		result.setErrorLinePosition(lastLineNumber(source));
		result.addErrorText("No @enduml found");
		result.setSuggest(Arrays.asList("Did you mean:", "@enduml"));
		return result;
	}
	final Diagram system = blocks.get(0).getDiagram();
	result.setCmapData(system.hasUrl());
	if (system instanceof UmlDiagram) {
		result.setUmlDiagramType(((UmlDiagram) system).getUmlDiagramType());
		result.setDescription(system.getDescription().getDescription());
	} else if (system instanceof PSystemError) {
		result.setError(true);
		final PSystemError sys = (PSystemError) system;
		result.setErrorLinePosition(sys.getHigherErrorPosition());
		result.setLineLocation(sys.getLineLocation());
		for (ErrorUml er : sys.getErrorsUml()) {
			result.addErrorText(er.getError());
		}
		result.setSuggest(sys.getSuggest());
	} else {
		result.setDescription(system.getDescription().getDescription());
	}
	return result;
}
 
開發者ID:Banno,項目名稱:sbt-plantuml-plugin,代碼行數:49,代碼來源:SyntaxChecker.java

示例5: getSystem

import net.sourceforge.plantuml.BlockUml; //導入依賴的package包/類
private Diagram getSystem() throws IOException, InterruptedException {
	final BlockUml blockUml = new BlockUml(lines2, 0);
	return blockUml.getDiagram();
}
 
開發者ID:Banno,項目名稱:sbt-plantuml-plugin,代碼行數:5,代碼來源:AtomEmbededSystem.java

示例6: getSystem

import net.sourceforge.plantuml.BlockUml; //導入依賴的package包/類
private Diagram getSystem() throws IOException, InterruptedException {
	final BlockUml blockUml = new BlockUml(lines2, 0);
	return blockUml.getDiagram();

}
 
開發者ID:Banno,項目名稱:sbt-plantuml-plugin,代碼行數:6,代碼來源:EmbededSystemLine.java

示例7: getSystem

import net.sourceforge.plantuml.BlockUml; //導入依賴的package包/類
private Diagram getSystem() throws IOException, InterruptedException {
	final BlockUml blockUml = new BlockUml(lines, 0);
	return blockUml.getDiagram();

}
 
開發者ID:mar9000,項目名稱:plantuml,代碼行數:6,代碼來源:AtomEmbededSystem.java

示例8: test

import net.sourceforge.plantuml.BlockUml; //導入依賴的package包/類
@Test
public void test() throws Exception {
    String plantuml2 = "[plantuml,role=concept]\n" +
                       "----\n" +
                       "@startuml\n" +
                       "[artifactId:xo.impl] as impl <<:Maven:Project>>\n" +
                       "[artifactId:xo.api] as api <<:Maven:Project>>\n" +
                       "[artifactId:xo.spi] as spi <<:Maven:Project>>\n" +
                       "\n" +
                       "impl -> api : Defines Dependency\n" +
                       "impl -> spi : Defines Dependency\n" +
                       "spi -> api : Defines Dependency\n" +
                       "@enduml\n"+
                       "----\n"
            ;

    String plantuml =
            "@startuml\n"+
            "package de.kontext_e.project.domain #ffffff {\n" +
            "}\n" +
            "package de.kontext_e.project.services #ffffff {\n" +
            "}\n" +
            "\n" +
            "de.kontext_e.project.services --> de.kontext_e.project.domain\n"+
            "@enduml\n"
            ;

    String nested =
            "@startuml\n"+
            "package de.kontext_e.project.domain #ffffff {\n" +
            "    package de.kontext_e.project.domain.sub1 {}\n" +
            "}\n" +
            "package de.kontext_e.project.services #ffffff {\n" +
            "}\n" +
            "\n" +
            "de.kontext_e.project.services --> de.kontext_e.project.domain\n"+
            "@enduml\n"
            ;


    SourceStringReader reader = new SourceStringReader(nested);
    List<BlockUml> blocks = reader.getBlocks();
    Diagram diagram = blocks.get(0).getDiagram();
    AbstractEntityDiagram descriptionDiagram = (AbstractEntityDiagram) diagram;
    EntityFactory entityFactory = descriptionDiagram.getEntityFactory();
    Map<Code, IGroup> groups = entityFactory.getGroups();
    assertThat(groups.size(), is(3));
    for (Map.Entry<Code, IGroup> codeIGroupEntry : groups.entrySet()) {
        IGroup iGroup = codeIGroupEntry.getValue();
        assertThat(iGroup.getCode().getFullName(), isOneOf(
                "de.kontext_e.project.domain",
                "de.kontext_e.project.domain.sub1",
                "de.kontext_e.project.services"
        ));
    }

    List<Link> links = entityFactory.getLinks();
    assertThat(links.size(), is(1));
    assertThat(links.get(0).getEntity1().getCode().getFullName(), is("de.kontext_e.project.services"));
    assertThat(links.get(0).getEntity2().getCode().getFullName(), is("de.kontext_e.project.domain"));
}
 
開發者ID:kontext-e,項目名稱:jqassistant-plugins,代碼行數:62,代碼來源:PumlTest.java


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