Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
HDouss committed Feb 29, 2020
1 parent 0720b3b commit cefd42b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/main/java/org/jpeek/graph/Node.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public interface Node {
* Calculates ingoing and outgoing connected nodes.
* @return List of nodes connected to this node.
*/
List<Node> connected();
List<Node> connections();

/**
* Simple implementation.
Expand Down Expand Up @@ -74,7 +74,7 @@ public String name() {
}

@Override
public List<Node> connected() {
public List<Node> connections() {
return this.connect;
}
}
Expand Down
23 changes: 9 additions & 14 deletions src/main/java/org/jpeek/graph/XmlGraph.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@

import com.jcabi.xml.XML;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.cactoos.list.Mapped;
import org.cactoos.text.Joined;
import org.jpeek.skeleton.Skeleton;

Expand Down Expand Up @@ -62,19 +62,14 @@ public List<Node> nodes() {
* @throws IOException If fails
*/
private static List<Node> build(final Skeleton skeleton) throws IOException {
final List<XML> methods = skeleton.xml().nodes(
"//methods/method[@ctor='false' and @abstract='false']"
return new Mapped<XML, Node>(
method -> new Node.Simple(
new Joined(
"", method.xpath("@name").get(0), method.xpath("@desc").get(0)
).asString()
), skeleton.xml().nodes(
"//methods/method[@ctor='false' and @abstract='false']"
)
);
final List<Node> result = new ArrayList<>(methods.size());
for (final XML method:methods) {
result.add(
new Node.Simple(
new Joined(
"", method.xpath("@name").get(0), method.xpath("@desc").get(0)
).asString()
)
);
}
return result;
}
}

0 comments on commit cefd42b

Please sign in to comment.