<commit_before>Stage stage = new Stage();

int nodeCount;
Node[] nodes = new Node[100];
HashMap nodeTable = new HashMap();

int edgeCount;
Edge[] edges = new Edge[500];

// use to track interactions between objects
TmpEdge tmpEdge;
Node tmpNode;
Node from;
Node to;

static final int WIDTH = 780;
static final int HEIGHT = 410;

static final color nodeColor   = #F0C070;
static final color selectColor = #FF3030;
static final color fixedColor  = #FF8080;
static final color edgeColor   = #000000;

static final int EXCHANGE = 0;
static final int QUEUE = 1;
static final int PRODUCER = 2;
static final int CONSUMER = 3;

static final int SOURCE = 0;
static final int DESTINATION = 1;

static final int TOOLBARWIDTH = 60;

color[] colors = new color[20];

PFont font;

void setup() {
  Processing.logger = console;
  
  size(780, 410);
  font = createFont("SansSerif", 10);
  textFont(font);
  smooth();
  
  colors[EXCHANGE] = #FF8408;
  colors[QUEUE] = #0816FF;
  colors[PRODUCER] = #3F4031;
  colors[CONSUMER] = #E1FF08;
  
  buildToolbar();
}

void buildToolbar() {
  addToolbarItem(EXCHANGE, "exchange", 30, 20);
  addToolbarItem(QUEUE, "queue", 30, 50);
  addToolbarItem(PRODUCER, "producer", 30, 80);
  addToolbarItem(CONSUMER, "consumer", 30, 110);
}

ToolbarItem[] toolbarItems = new ToolbarItem[20];
int toolbarItemsCount;

ToolbarItem addToolbarItem(int type, String label, float x, float y) {
  ToolbarItem t = new ToolbarItem(type, label, x, y);
  toolbarItems[toolbarItemsCount++] = t;
  return t;
}

boolean addEdge(Node from, Node to) {
  for (int i = 0; i < edgeCount; i++) {
    if ((edges[i].from == from && edges[i].to == to) ||
        (edges[i].to == from && edges[i].from == to)) {
      return false;
    }
  }
  
  Edge e = new Edge(from, to, edgeColor);
  if (edgeCount == edges.length) {
    edges = (Edge[]) expand(edges);
  }
  edges[edgeCount++] = e;
  return true;
}

Node newNodeByType(int type, String label, float x, float y) {
  Node n = null;
  switch (type) {
    case EXCHANGE:
      n = new Exchange(label, x, y);
      break;
    case QUEUE:
      n = new Queue(label, x, y);
      break;
    case PRODUCER:
      n = new Producer(label, x, y);
      break;
    case CONSUMER:
      n = new Consumer(label, x, y);
      break;
    default:
      println("Unknown type");
      break;
  }
  return n;
}

Node addNodeByType(int type, String label, float x, float y) {
  Node n = newNodeByType(type, label, x, y);
  
  if (n != null) {
      if (nodeCount == nodes.length) {
        nodes = (Node[]) expand(nodes);
      }
  
      nodeTable.put(label, n);
      nodes[nodeCount++] = n;
  }
  
  return n;
}

Node findNode(String label) {
  return nodeTable.get(label);
}

void draw() {
  background(255);
  
  stroke(0);
  strokeWeight(2);
  noFill();
  rect(0, 0, WIDTH, HEIGHT);
  line(TOOLBARWIDTH, 0, TOOLBARWIDTH, height);
  
  for (int i = 0; i < toolbarItemsCount ; i++) {
    toolbarItems[i].draw();
  }
  
  for (int i = 0 ; i < edgeCount ; i++) {<commit_msg>adds changeNodeName function<commit_after>Stage stage = new Stage();

int nodeCount;
Node[] nodes = new Node[100];
HashMap nodeTable = new HashMap();

int edgeCount;
Edge[] edges = new Edge[500];

// use to track interactions between objects
TmpEdge tmpEdge;
Node tmpNode;
Node from;
Node to;

static final int WIDTH = 780;
static final int HEIGHT = 410;

static final color nodeColor   = #F0C070;
static final color selectColor = #FF3030;
static final color fixedColor  = #FF8080;
static final color edgeColor   = #000000;

static final int EXCHANGE = 0;
static final int QUEUE = 1;
static final int PRODUCER = 2;
static final int CONSUMER = 3;

static final int SOURCE = 0;
static final int DESTINATION = 1;

static final int TOOLBARWIDTH = 60;

color[] colors = new color[20];

PFont font;

void setup() {
  Processing.logger = console;
  
  size(780, 410);
  font = createFont("SansSerif", 10);
  textFont(font);
  smooth();
  
  colors[EXCHANGE] = #FF8408;
  colors[QUEUE] = #0816FF;
  colors[PRODUCER] = #3F4031;
  colors[CONSUMER] = #E1FF08;
  
  buildToolbar();
}

void buildToolbar() {
  addToolbarItem(EXCHANGE, "exchange", 30, 20);
  addToolbarItem(QUEUE, "queue", 30, 50);
  addToolbarItem(PRODUCER, "producer", 30, 80);
  addToolbarItem(CONSUMER, "consumer", 30, 110);
}

ToolbarItem[] toolbarItems = new ToolbarItem[20];
int toolbarItemsCount;

ToolbarItem addToolbarItem(int type, String label, float x, float y) {
  ToolbarItem t = new ToolbarItem(type, label, x, y);
  toolbarItems[toolbarItemsCount++] = t;
  return t;
}

boolean addEdge(Node from, Node to) {
  for (int i = 0; i < edgeCount; i++) {
    if ((edges[i].from == from && edges[i].to == to) ||
        (edges[i].to == from && edges[i].from == to)) {
      return false;
    }
  }
  
  Edge e = new Edge(from, to, edgeColor);
  if (edgeCount == edges.length) {
    edges = (Edge[]) expand(edges);
  }
  edges[edgeCount++] = e;
  return true;
}

Node newNodeByType(int type, String label, float x, float y) {
  Node n = null;
  switch (type) {
    case EXCHANGE:
      n = new Exchange(label, x, y);
      break;
    case QUEUE:
      n = new Queue(label, x, y);
      break;
    case PRODUCER:
      n = new Producer(label, x, y);
      break;
    case CONSUMER:
      n = new Consumer(label, x, y);
      break;
    default:
      println("Unknown type");
      break;
  }
  return n;
}

Node addNodeByType(int type, String label, float x, float y) {
  Node n = newNodeByType(type, label, x, y);
  
  if (n != null) {
      if (nodeCount == nodes.length) {
        nodes = (Node[]) expand(nodes);
      }
  
      nodeTable.put(label, n);
      nodes[nodeCount++] = n;
  }
  
  return n;
}

Node findNode(String label) {
  return nodeTable.get(label);
}

void changeNodeName(String oldName, String name) {
  println("changeNodeName called");
  Node n = findNode(oldName);
  n.changeName(name);
  nodeTable.remove(oldName);
  nodeTable.put(name, n);
}

void draw() {
  background(255);
  
  stroke(0);
  strokeWeight(2);
  noFill();
  rect(0, 0, WIDTH, HEIGHT);
  line(TOOLBARWIDTH, 0, TOOLBARWIDTH, height);
  
  for (int i = 0; i < toolbarItemsCount ; i++) {
    toolbarItems[i].draw();
  }
  
  for (int i = 0 ; i < edgeCount ; i++) {
{'fraction_non_alphanumeric': 0.13842443729903536, 'fraction_numerical': 0.03022508038585209, 'mean_word_length': 3.3201388888888888, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 3, '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': '3569274', 'n_tokens_mistral': 2384, 'n_tokens_neox': 2226, 'n_words': 664}