protected List<Artifact> parseArtifacts(int parentNestingLevel, String... lines) { List<Artifact> foundArtifacts = new ArrayList<>(); // find all lines for "this" artifact for (int i = 1; i < lines.length; i++) { String line = lines[i]; if (line.equals("No dependencies")) { return foundArtifacts; } int lineNestingLevel = parseNestingLevel(line); // dependencies of the current artifact if (lineNestingLevel == (parentNestingLevel + 1)) { String[] newLines = getArtifactLines(new Pointer(i), lines); Artifact artifact = new Artifact(line, masterArtifactList); foundArtifacts.add(artifact); addArtifact(artifact); artifact.parseArtifacts(lineNestingLevel, newLines); i += newLines.length - 1; } else // lineNestingLevel < currentNestingLevel { // currentArtifact = currentArtifact.getParent(); // addChildArtifact(this, line); return foundArtifacts; // pop off the stack } } return foundArtifacts; }