<commit_before>/*
 * Copyright 2012 Red Hat, Inc. and/or its affiliates.
 *
 * Licensed under the Eclipse Public License version 1.0, available at
 * http://www.eclipse.org/legal/epl-v10.html
 */

package org.jboss.forge.maven.container;

import java.util.ArrayList;
import java.util.List;

import org.jboss.forge.addon.dependency.Dependency;
import org.jboss.forge.addon.dependency.DependencyNode;

public class MavenDependencyNode implements DependencyNode
{
   private Dependency dependency;
   private List<DependencyNode> children = new ArrayList<DependencyNode>();

   public MavenDependencyNode(Dependency dependency)
   {
      super();
      this.dependency = dependency;
   }

   @Override
   public Dependency getDependency()
   {
      return dependency;
   }

   @Override
   public List<DependencyNode> getChildren()
   {
      return children;
   }

   @Override
   public String toString()
   {
      StringBuilder builder = new StringBuilder();
      prettyPrint(builder, 0);
      return builder.toString();
   }

   protected void prettyPrint(StringBuilder builder, int depth)
   {
      for (int i = 0; i < depth; i++)
      {
         builder.append("\t");
      }
      builder.append("|-").append(dependency).append("\n");
      for (DependencyNode child : getChildren())
      {
         ((MavenDependencyNode) child).prettyPrint(builder, depth + 1);
      }
   }

}<commit_msg>Better tree visualization<commit_after>/*
 * Copyright 2012 Red Hat, Inc. and/or its affiliates.
 *
 * Licensed under the Eclipse Public License version 1.0, available at
 * http://www.eclipse.org/legal/epl-v10.html
 */

package org.jboss.forge.maven.container;

import java.util.ArrayList;
import java.util.List;

import org.jboss.forge.addon.dependency.Dependency;
import org.jboss.forge.addon.dependency.DependencyNode;

public class MavenDependencyNode implements DependencyNode
{
   private Dependency dependency;
   private List<DependencyNode> children = new ArrayList<DependencyNode>();

   public MavenDependencyNode(Dependency dependency)
   {
      super();
      this.dependency = dependency;
   }

   @Override
   public Dependency getDependency()
   {
      return dependency;
   }

   @Override
   public List<DependencyNode> getChildren()
   {
      return children;
   }

   @Override
   public String toString()
   {
      StringBuilder builder = new StringBuilder();
      prettyPrint(builder, 0);
      return builder.toString();
   }

   protected void prettyPrint(StringBuilder builder, int depth)
   {
      for (int i = 0; i < depth; i++)
      {
         builder.append(" ");
      }
      if (depth > 0) {
         builder.append("|-");
      }
      builder.append(dependency).append("\n");
      for (DependencyNode child : getChildren())
      {
         ((MavenDependencyNode) child).prettyPrint(builder, depth + 1);
      }
   }

}
{'fraction_non_alphanumeric': 0.11138268156424581, 'fraction_numerical': 0.00803072625698324, 'mean_word_length': 3.006993006993007, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4557967', 'n_tokens_mistral': 855, 'n_tokens_neox': 792, 'n_words': 198}