<commit_before>package com.github.ferstl.depgraph.graph.style;

import com.google.common.base.Joiner;

public final class StyleKey implements Comparable<StyleKey> {

  private static final int NUM_ELEMENTS = 5;

  String groupId;
  String artifactId;
  String scope;
  String type;
  String version;


  private StyleKey(String[] parts) {
    if (parts.length > NUM_ELEMENTS) {
      throw new IllegalArgumentException("Too many parts. Expecting '<groupId>:<artifactId>:<version>:<scope>:<type>'");
    }

    String[] expanded = new String[NUM_ELEMENTS];
    for (int i = 0; i < parts.length; i++) {
      expanded[i] = parts[i];
    }

    this.groupId = expanded[0];
    this.artifactId = expanded[1];
    this.scope = expanded[2];
    this.type = expanded[3];
    this.version = expanded[4];
  }

  public static StyleKey fromString(String keyString) {
    String[] parts = keyString.split(",");
    return new StyleKey(parts);
  }

  @Override
  public int compareTo(StyleKey o) {
    return getRank() - o.getRank();
  }

  @Override
  public boolean equals(Object obj) {
    if (obj == this) {
      return true;
    }

    if (!(obj instanceof StyleKey)) {
      return false;
    }<commit_msg>Fields should always be null (no empty strings)<commit_after>package com.github.ferstl.depgraph.graph.style;

import org.apache.commons.lang3.StringUtils;
import com.google.common.base.Joiner;

public final class StyleKey implements Comparable<StyleKey> {

  private static final int NUM_ELEMENTS = 5;

  String groupId;
  String artifactId;
  String scope;
  String type;
  String version;


  private StyleKey(String[] parts) {
    if (parts.length > NUM_ELEMENTS) {
      throw new IllegalArgumentException("Too many parts. Expecting '<groupId>:<artifactId>:<version>:<scope>:<type>'");
    }

    String[] expanded = new String[NUM_ELEMENTS];
    for (int i = 0; i < parts.length; i++) {
      expanded[i] = StringUtils.defaultIfEmpty(parts[i], null);
    }

    this.groupId = expanded[0];
    this.artifactId = expanded[1];
    this.scope = expanded[2];
    this.type = expanded[3];
    this.version = expanded[4];
  }

  public static StyleKey fromString(String keyString) {
    String[] parts = keyString.split(",");
    return new StyleKey(parts);
  }

  @Override
  public int compareTo(StyleKey o) {
    return getRank() - o.getRank();
  }

  @Override
  public boolean equals(Object obj) {
    if (obj == this) {
      return true;
    }

    if (!(obj instanceof StyleKey)) {
      return false;
    }
{'fraction_non_alphanumeric': 0.1268389662027833, 'fraction_numerical': 0.005964214711729622, 'mean_word_length': 3.3680555555555554, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '6541314', 'n_tokens_mistral': 815, 'n_tokens_neox': 768, 'n_words': 204}