<commit_before>package gvs.ui.tree.view;

import java.util.Vector;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import gvs.interfaces.IBinaryNode;
import gvs.ui.tree.model.BinaryNode;

public class ClusterSplitterGVS extends ClusterSplitter implements Runnable {

  private static boolean mEnabled = false;

  private static VisualizationTreePanel mPanel;

  private Logger mTreeContLogger;

  ClusterSplitterGVS() {
    // TODO check Logger replacement
    // mTreeContLogger =
    // gvs.common.Logger.getInstance().getTreeControllerLogger();
    setmTreeContLogger(LoggerFactory.getLogger(ClusterSplitterGVS.class));
  }

  ClusterSplitterGVS(VisualizationTreePanel pPanel) {
    this();
    setmPanel(pPanel);
  }

  public void run() {

    int depth;
    NodeLineImpl nodeLine = null;
    Vector<IBinaryNode> sortedNodes = null;
    // TODO investigate NullPointerException: occurs if clustersplitting is
    // active. Same happens in GVS 1.0
    double width = getmPanel().getTreeLayoutController().getMaxDimensionWidth();
    int result = 0;

    depth = 5;
    nodeLine = new NodeLineImpl(depth, width, 1);
    sortedNodes = getmPanel().getTreeLayoutController().getSortedNodes();
    for (IBinaryNode node : sortedNodes) {
      if (node.getMyTreeLevel() == depth) {
        nodeLine.add(node);
      }
    }
    if (nodeLine.getSize() > 0) {
      nodeLine.print();
      result = split(nodeLine);
      if (result != 0) {
        getmTreeContLogger().warn(
            "ClusterSplitterGVS::run(): no Solution for Depth = " + depth);
        getmTreeContLogger()
            .warn("  Reason: " + ((result == -1) ? "Same Line" : "No Actions"));
      }
    }

    depth = 6;
    nodeLine = new NodeLineImpl(depth, width, 3);
    sortedNodes = getmPanel().getTreeLayoutController().getSortedNodes();
    for (IBinaryNode node : sortedNodes) {
      if (node.getMyTreeLevel() == depth) {
        nodeLine.add(node);
      }
    }
    if (nodeLine.getSize() > 0) {
      nodeLine.print();
      result = split(nodeLine);
      if (result != 0) {
        getmTreeContLogger().warn(
            "ClusterSplitterGVS::run(): no Solution for Depth = " + depth);
        getmTreeContLogger()
            .warn("  Reason: " + ((result == -1) ? "Same Line" : "No Actions"));
      }
    }

    depth = 7;
    nodeLine = new NodeLineImpl(depth, width, 5);
    sortedNodes = getmPanel().getTreeLayoutController().getSortedNodes();
    for (IBinaryNode node : sortedNodes) {
      if (node.getMyTreeLevel() == depth) {
        nodeLine.add(node);
      }
    }
    if (nodeLine.getSize() > 0) {
      nodeLine.print();
      result = split(nodeLine);
      if (result != 0) {
        getmTreeContLogger().warn(
            "ClusterSplitterGVS::run(): no Solution for Depth = " + depth);
        getmTreeContLogger()
            .warn("  Reason: " + ((result == -1) ? "Same Line" : "No Actions"));
      }
    }

    getmPanel().repaint();<commit_msg>95: Cluster Splitter Bindings (cast INode to IBinaryNode)<commit_after>package gvs.ui.tree.view;

import java.util.Vector;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import gvs.interfaces.IBinaryNode;
import gvs.interfaces.INode;
import gvs.ui.tree.model.BinaryNode;

public class ClusterSplitterGVS extends ClusterSplitter implements Runnable {

  private static boolean mEnabled = false;

  private static VisualizationTreePanel mPanel;

  private Logger mTreeContLogger;

  ClusterSplitterGVS() {
    // TODO check Logger replacement
    // mTreeContLogger =
    // gvs.common.Logger.getInstance().getTreeControllerLogger();
    setmTreeContLogger(LoggerFactory.getLogger(ClusterSplitterGVS.class));
  }

  ClusterSplitterGVS(VisualizationTreePanel pPanel) {
    this();
    setmPanel(pPanel);
  }

  public void run() {

    int depth;
    NodeLineImpl nodeLine = null;
    Vector<INode> sortedNodes = null;
    // TODO investigate NullPointerException: occurs if clustersplitting is
    // active. Same happens in GVS 1.0
    double width = getmPanel().getTreeLayoutController().getMaxDimensionWidth();
    int result = 0;

    depth = 5;
    nodeLine = new NodeLineImpl(depth, width, 1);
    sortedNodes = getmPanel().getTreeLayoutController().getSortedNodes();
    for (INode node : sortedNodes) {
      IBinaryNode binaryNode = (IBinaryNode) node;
      if (binaryNode.getMyTreeLevel() == depth) {
        nodeLine.add(binaryNode);
      }
    }
    if (nodeLine.getSize() > 0) {
      nodeLine.print();
      result = split(nodeLine);
      if (result != 0) {
        getmTreeContLogger().warn(
            "ClusterSplitterGVS::run(): no Solution for Depth = " + depth);
        getmTreeContLogger()
            .warn("  Reason: " + ((result == -1) ? "Same Line" : "No Actions"));
      }
    }

    depth = 6;
    nodeLine = new NodeLineImpl(depth, width, 3);
    sortedNodes = getmPanel().getTreeLayoutController().getSortedNodes();
    for (INode node : sortedNodes) {
      IBinaryNode binaryNode = (IBinaryNode) node;
      if (binaryNode.getMyTreeLevel() == depth) {
        nodeLine.add(binaryNode);
      }
    }
    if (nodeLine.getSize() > 0) {
      nodeLine.print();
      result = split(nodeLine);
      if (result != 0) {
        getmTreeContLogger().warn(
            "ClusterSplitterGVS::run(): no Solution for Depth = " + depth);
        getmTreeContLogger()
            .warn("  Reason: " + ((result == -1) ? "Same Line" : "No Actions"));
      }
    }

    depth = 7;
    nodeLine = new NodeLineImpl(depth, width, 5);
    sortedNodes = getmPanel().getTreeLayoutController().getSortedNodes();
    for (INode node : sortedNodes) {
      IBinaryNode binaryNode = (IBinaryNode) node;
      if (binaryNode.getMyTreeLevel() == depth) {
        nodeLine.add(binaryNode);
      }
    }
    if (nodeLine.getSize() > 0) {
      nodeLine.print();
      result = split(nodeLine);
      if (result != 0) {
        getmTreeContLogger().warn(
            "ClusterSplitterGVS::run(): no Solution for Depth = " + depth);
        getmTreeContLogger()
            .warn("  Reason: " + ((result == -1) ? "Same Line" : "No Actions"));
      }
    }

    getmPanel().repaint();
{'fraction_non_alphanumeric': 0.1292207792207792, 'fraction_numerical': 0.006818181818181818, 'mean_word_length': 2.8530331457160725, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '2364870', 'n_tokens_mistral': 1956, 'n_tokens_neox': 1887, 'n_words': 420}