当前位置: 首页>>代码示例>>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;未经允许,请勿转载。