<commit_before>class InputOutput {
  float x, y;
  float cX, cY;
  int pX, pY;

  float head;
  int direction; // 0(right) - 7 clockwise  


  boolean isPenDown;
  float penSize, bigPenSize, defaultPenSize;
  color penColor;
  float stepSize;

  String name;
  int commandIndex;
  boolean commandEnd;
  ArrayList<String> commands;


  // HubNetwork & index
  HubNetwork h;
  int hi;

  Display display;
  PGraphics c;

  //AudioOutput out;
  Oscil wave;


  //InputOutput(String aName, float posX, float posY) { // XXX change to grid postion system.
  InputOutput(Display d, String aName) {
    setDisplay(d);

    //pX = posX;
    //pY = posY;
    head = 0;
    isPenDown = false;
    penSize = 2;
    defaultPenSize = 2;
    bigPenSize = 5;
    penColor = color(0);
    stepSize = 10; // XXX now use canvasStep Width/Height

    name = aName;
    commandIndex = 0;
    commandEnd = false;
    commands = new ArrayList<String>();
    //hubIndex = id-1;
  }

  void setStartPosition(int posX, int posY) {
    x = posX*display.canvasStepWidth;
    y = posY*display.canvasStepHeight;
  }

  float getXfromCanvasPosX(int p) {
    return display.startX + display.canvasStepWidth * p;
  }
  float getYfromCanvasPosY(int p) {
    return display.startY + display.canvasStepHeight * p;
  }
  //float getCX(int p) {
  //  return display.canvasStepWidth * p;
  //}
  //float getCY(int p) {
  //  return display.canvasStepHeight * p;
  //}

  void show(int in) {
    if (isTrue(in) && commandEnd) {
      cX = display.startX + x;
      cY = display.startY + y;
      //float px = getXfromCanvasPosX(pX);
      //float py = getYfromCanvasPosY(pY);


      stroke(250);
      strokeWeight(2);
      fill(penColor);
      ellipse(cX, cY, penSize*4, penSize*4);
    }
  }

  void setHubConf(HubNetwork hub, int id) {
    h = hub;
    hi = id - 1;
  }

  void setDisplay(Display d) {
    display = d;
    c = display.canvas;
  }


  String getCodeString() {
    String codeString = name;

    for (int i=0; i<commands.size(); i++) {
      String c = commands.get(i);
      codeString = codeString + "." + c + "(" + h.bits[hi][i] + ")";
    }

    commands = new ArrayList<String>();
    return codeString;
  }

  void addCommand(String command) {
    if (!commandEnd) {
      commands.add(command);
    }
  }
  
  void end() {
    commandEnd = true;
  }

  boolean isTrue(int in) {
    if (in == 1) return true;
    else return false;
  }

  // ###################### Sound ######################
  //void setSound(AudioOutput o) {
  //  //out = o;
  //  //wave = w;
  //  //wave.patch(out);
  //  out = o;
  //}


  InputOutput play(int in) {
    //if (isTrue(in)) {
    //  OUT.playNote(1.0, 0.3, new SineInstrument( 123.47 ));
    //}
    return this;
  }

  // ###################### Color ######################
  InputOutput setColor(color c) {
    penColor = c;
    return this;
  }

  InputOutput red(int in) {
    if (isTrue(in)) {
      penColor = color(#ff3333);
    } 

    addCommand("赤");
    return this;
  }

  InputOutput black(int in) {
    if (isTrue(in)) {
      penColor = color(#000000);
    } 

    addCommand("黒");
    return this;
  }

  InputOutput blue(int in) {
    if (isTrue(in)) {
      penColor = color(#66CCFF);
    } 

    addCommand("青");
    return this;
  }

  InputOutput green(int in) {
    if (isTrue(in)) {
      penColor = color(#66cc99);
    } 

    addCommand("緑");
    return this;
  }

  InputOutput yellow(int in) {
    if (isTrue(in)) {
      penColor = color(#ffcc00);
    } 

    addCommand("黄");
    return this;
  }

  InputOutput penDown(int in) {
    if (isTrue(in)) {
      isPenDown = true;
    } else {
      isPenDown = false;
    }

    addCommand("ペ降");
    return this;
  }

  InputOutput penUp(int in) {
    if (isTrue(in)) {
      isPenDown = false;
    } else {
      isPenDown = true;
    }<commit_msg>change a word for penDown<commit_after>class InputOutput {
  float x, y;
  float cX, cY;
  int pX, pY;

  float head;
  int direction; // 0(right) - 7 clockwise  


  boolean isPenDown;
  float penSize, bigPenSize, defaultPenSize;
  color penColor;
  float stepSize;

  String name;
  int commandIndex;
  boolean commandEnd;
  ArrayList<String> commands;


  // HubNetwork & index
  HubNetwork h;
  int hi;

  Display display;
  PGraphics c;

  //AudioOutput out;
  Oscil wave;


  //InputOutput(String aName, float posX, float posY) { // XXX change to grid postion system.
  InputOutput(Display d, String aName) {
    setDisplay(d);

    //pX = posX;
    //pY = posY;
    head = 0;
    isPenDown = false;
    penSize = 2;
    defaultPenSize = 2;
    bigPenSize = 5;
    penColor = color(0);
    stepSize = 10; // XXX now use canvasStep Width/Height

    name = aName;
    commandIndex = 0;
    commandEnd = false;
    commands = new ArrayList<String>();
    //hubIndex = id-1;
  }

  void setStartPosition(int posX, int posY) {
    x = posX*display.canvasStepWidth;
    y = posY*display.canvasStepHeight;
  }

  float getXfromCanvasPosX(int p) {
    return display.startX + display.canvasStepWidth * p;
  }
  float getYfromCanvasPosY(int p) {
    return display.startY + display.canvasStepHeight * p;
  }
  //float getCX(int p) {
  //  return display.canvasStepWidth * p;
  //}
  //float getCY(int p) {
  //  return display.canvasStepHeight * p;
  //}

  void show(int in) {
    if (isTrue(in) && commandEnd) {
      cX = display.startX + x;
      cY = display.startY + y;
      //float px = getXfromCanvasPosX(pX);
      //float py = getYfromCanvasPosY(pY);


      stroke(250);
      strokeWeight(2);
      fill(penColor);
      ellipse(cX, cY, penSize*4, penSize*4);
    }
  }

  void setHubConf(HubNetwork hub, int id) {
    h = hub;
    hi = id - 1;
  }

  void setDisplay(Display d) {
    display = d;
    c = display.canvas;
  }


  String getCodeString() {
    String codeString = name;

    for (int i=0; i<commands.size(); i++) {
      String c = commands.get(i);
      codeString = codeString + "." + c + "(" + h.bits[hi][i] + ")";
    }

    commands = new ArrayList<String>();
    return codeString;
  }

  void addCommand(String command) {
    if (!commandEnd) {
      commands.add(command);
    }
  }
  
  void end() {
    commandEnd = true;
  }

  boolean isTrue(int in) {
    if (in == 1) return true;
    else return false;
  }

  // ###################### Sound ######################
  //void setSound(AudioOutput o) {
  //  //out = o;
  //  //wave = w;
  //  //wave.patch(out);
  //  out = o;
  //}


  InputOutput play(int in) {
    //if (isTrue(in)) {
    //  OUT.playNote(1.0, 0.3, new SineInstrument( 123.47 ));
    //}
    return this;
  }

  // ###################### Color ######################
  InputOutput setColor(color c) {
    penColor = c;
    return this;
  }

  InputOutput red(int in) {
    if (isTrue(in)) {
      penColor = color(#ff3333);
    } 

    addCommand("赤");
    return this;
  }

  InputOutput black(int in) {
    if (isTrue(in)) {
      penColor = color(#000000);
    } 

    addCommand("黒");
    return this;
  }

  InputOutput blue(int in) {
    if (isTrue(in)) {
      penColor = color(#66CCFF);
    } 

    addCommand("青");
    return this;
  }

  InputOutput green(int in) {
    if (isTrue(in)) {
      penColor = color(#66cc99);
    } 

    addCommand("緑");
    return this;
  }

  InputOutput yellow(int in) {
    if (isTrue(in)) {
      penColor = color(#ffcc00);
    } 

    addCommand("黄");
    return this;
  }

  InputOutput penDown(int in) {
    if (isTrue(in)) {
      isPenDown = true;
    } else {
      isPenDown = false;
    }

    addCommand("ペ下");
    return this;
  }

  InputOutput penUp(int in) {
    if (isTrue(in)) {
      isPenDown = false;
    } else {
      isPenDown = true;
    }
{'fraction_non_alphanumeric': 0.15789473684210525, 'fraction_numerical': 0.012185636505055743, 'mean_word_length': 2.2927870251813913, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, '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': '789882', 'n_tokens_mistral': 2904, 'n_tokens_neox': 2745, 'n_words': 654}