use of de.strullerbaumann.visualee.dependency.entity.DependencyType in project visualee by Thomas-S-B.
the class DependencyContainer method getFilteredJavaSources.
//TODO simplify
public Set<JavaSource> getFilteredJavaSources(DependencyFilter filter) {
Set<JavaSource> filteredJavaSources = new HashSet<>();
if (filter != null && filter.isDirectlyConnected()) {
DependencyType primaryType = filter.getFilterTypes().get(0);
for (Dependency d : getDependenciesOfType(primaryType)) {
JavaSource to = d.getJavaSourceTo();
List<Dependency> injects = new ArrayList<>();
for (DependencyType dFilter : filter.getFilterTypes()) {
if (!dFilter.equals(primaryType)) {
injects.addAll(findAllDependenciesWith(to, dFilter));
}
}
if (injects.size() > 0) {
filteredJavaSources.add(d.getJavaSourceFrom());
filteredJavaSources.add(to);
for (Dependency inject : injects) {
filteredJavaSources.add(inject.getJavaSourceFrom());
}
}
}
} else {
for (Dependency dependency : DEPENDENCIES) {
if (filter == null || filter.contains(dependency.getDependencyType())) {
filteredJavaSources.add(dependency.getJavaSourceFrom());
filteredJavaSources.add(dependency.getJavaSourceTo());
}
}
}
return filteredJavaSources;
}
use of de.strullerbaumann.visualee.dependency.entity.DependencyType in project visualee by Thomas-S-B.
the class Description method generateDescription.
public static String generateDescription(JavaSource javaSource) {
StringBuilder description = new StringBuilder();
description.append("<nobr>Package: ").append(javaSource.getPackagePath()).append("</nobr>");
HashMap<DependencyType, StringBuilder> descriptionParts = new HashMap<>();
for (DependencyType type : DependencyType.values()) {
descriptionParts.put(type, new StringBuilder());
}
for (Dependency dependency : DependencyContainer.getInstance().getDependencies(javaSource)) {
StringBuilder descriptionPart = descriptionParts.get(dependency.getDependencyType());
assert descriptionPart != null : "Unknown DependencyType";
descriptionPart.append("<br/><nobr>");
String desc = DESCRIPTIONS.get(dependency.getDependencyType());
desc = desc.replaceAll(JAVASOURCE_TO, dependency.getJavaSourceTo().toString());
descriptionPart.append(desc);
descriptionPart.append("</nobr>");
}
for (DependencyType type : descriptionParts.keySet()) {
description.append(getDescriptionPart(type, descriptionParts.get(type).toString()));
}
return description.toString();
}
use of de.strullerbaumann.visualee.dependency.entity.DependencyType in project visualee by Thomas-S-B.
the class ExaminerInstanceTest method testgetTypeFromToken.
@Test
public void testgetTypeFromToken() {
String sourceLine;
DependencyType actual;
sourceLine = "My test sourcecode";
actual = examiner.getTypeFromToken(sourceLine);
assertEquals(null, actual);
sourceLine = "@Inject TestCalss myTestClass;";
actual = examiner.getTypeFromToken(sourceLine);
assertEquals(DependencyType.INJECT, actual);
}
use of de.strullerbaumann.visualee.dependency.entity.DependencyType in project visualee by Thomas-S-B.
the class ExaminerEventTest method testgetTypeFromToken.
@Test
public void testgetTypeFromToken() {
String sourceLine;
DependencyType actual;
sourceLine = "My test sourcecode";
actual = examiner.getTypeFromToken(sourceLine);
assertEquals(null, actual);
sourceLine = "@Inject TestCalss myTestClass;";
actual = examiner.getTypeFromToken(sourceLine);
assertEquals(DependencyType.INJECT, actual);
}
use of de.strullerbaumann.visualee.dependency.entity.DependencyType in project visualee by Thomas-S-B.
the class ExaminerInjectTest method testgetTypeFromToken.
@Test
public void testgetTypeFromToken() {
String sourceLine;
DependencyType actual;
sourceLine = "My test sourcecode";
actual = examiner.getTypeFromToken(sourceLine);
assertEquals(null, actual);
sourceLine = "@Inject TestCalss myTestClass;";
actual = examiner.getTypeFromToken(sourceLine);
assertEquals(DependencyType.INJECT, actual);
}
Aggregations