<commit_before>/*
 * Copyright (c) 2014 - 2017 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.github.ferstl.depgraph.dependency.text;

import com.github.ferstl.depgraph.dependency.DependencyNode;
import com.github.ferstl.depgraph.dependency.NodeResolution;
import com.github.ferstl.depgraph.graph.EdgeRenderer;

public class TextDependencyEdgeRenderer implements EdgeRenderer<DependencyNode> {

  private final boolean showVersions;

  public TextDependencyEdgeRenderer(boolean showVersionOnEdges) {
    this.showVersions = showVersionOnEdges;
  }

  @Override
  public String render(DependencyNode from, DependencyNode to) {
    if (to.getResolution() == NodeResolution.OMITTED_FOR_CONFLICT) {
      String message = "omitted for conflict";
      if (this.showVersions) {
        message += ": " + to.getArtifact().getVersion();
      }

      return message;
    }

    return "";
  }
}<commit_msg>#67 Show duplicates in text graph<commit_after>/*
 * Copyright (c) 2014 - 2017 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.github.ferstl.depgraph.dependency.text;

import com.github.ferstl.depgraph.dependency.DependencyNode;
import com.github.ferstl.depgraph.graph.EdgeRenderer;

public class TextDependencyEdgeRenderer implements EdgeRenderer<DependencyNode> {

  private final boolean showVersions;

  public TextDependencyEdgeRenderer(boolean showVersionOnEdges) {
    this.showVersions = showVersionOnEdges;
  }

  @Override
  public String render(DependencyNode from, DependencyNode to) {
    switch (to.getResolution()) {
      case OMITTED_FOR_CONFLICT:
        String message = "omitted for conflict";
        if (this.showVersions) {
          message += ": " + to.getArtifact().getVersion();
        }

        return message;

      case OMITTED_FOR_DUPLICATE:
        return "omitted for duplicate";

      default:
        return "";
    }
  }
}
{'fraction_non_alphanumeric': 0.08392077878482712, 'fraction_numerical': 0.00872776099362202, 'mean_word_length': 3.745222929936306, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 5, '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': '5836054', 'n_tokens_mistral': 839, 'n_tokens_neox': 795, 'n_words': 275}