<commit_before><?php

class Experiment {

  public function __construct($experiment_id, $write_access=False) {
    global $data_path;
    $this->id = $experiment_id;
    $experiments_file = new File($data_path .'experiments', False);
    $this->owner = $this->extractElement($this->id, $experiments_file->data);
    $this->file = new File($data_path .'user_data/'. $this->owner .'/'. $this->id, $write_access);
    $this->changed_data = array();
  }

  public function saveExperimentData() {
    foreach ($this->changed_data as $parameter) {
      $old_piece = $parameter . ' = {' . $this->extractElement($parameter, $this->file->data) . '}';
      if ($parameter == 'calendar') { $new_piece = $parameter . ' = {' . $this->flattenCalendar() . '}'; }
      else { $new_piece = $parameter . ' = {' . $this->$parameter . '}'; }
      $this->file->data = str_replace($old_piece, $new_piece, $this->file->data);
    }
    return $this->file->overwrite();
  }

  public function getName() {
    if (isset($this->name) == False) {
      $this->name = $this->extractElement('name', $this->file->data);
    }
    return $this->name;
  }

  public function setName($name) {
    if ($name != $this->getName()) {
      $this->name = $name;
      $this->changed_data[] = 'name';
    }
  }

  public function getStatus() {
    if (isset($this->status) == False) {
      $this->status = $this->extractElement('status', $this->file->data);
      if ($this->status == 'open') {
        if (count($this->getAvailableSlots()) == 0) {
          $this->status = 'unavailable';
        }
      }
    }
    return $this->status;
  }

  public function setStatus($status) {
    $this->status = $status;
    $this->changed_data[] = 'status';
  }

  public function getDescription() {
    if (isset($this->description) == False) {
      $this->description = str_replace("\n", '<br />', $this->extractElement('description', $this->file->data));
    }
    return $this->description;
  }

  public function setDescription($description) {
    if ($description != $this->getDescription()) {
      $this->description = $description;
      $this->changed_data[] = 'description';
    }
  }

  public function getLocation() {
    if (isset($this->location) == False) {
      $this->location = $this->extractElement('location', $this->file->data);
    }
    return $this->location;
  }

  public function setLocation($location) {
    if ($location != $this->getLocation()) {
      $this->location = $location;
      $this->changed_data[] = 'location';
    }
  }

  public function getRequirements() {
    if (isset($this->requirements) == False) {
      $this->requirements = explode('; ', $this->extractElement('requirements', $this->file->data));
    }
    return $this->requirements;
  }

  public function setRequirements($requirements) {
    $this->requirements = $requirements;
    $this->changed_data[] = 'requirements';
  }

  public function getExclusions() {
    if (isset($this->exclusions) == False) {
      $this->exclusions = explode('; ', $this->extractElement('exclusions', $this->file->data));
    }
    return $this->exclusions;
  }

  public function setExclusions($exclusions) {
    $this->exclusions = $exclusions;
    $this->changed_data[] = 'exclusions';
  }

  public function getPerSlot() {
    if (isset($this->per_slot) == False) {
      $this->per_slot = $this->extractElement('per_slot', $this->file->data);
    }
    return $this->per_slot;
  }

  public function setPerSlot($per_slot) {
    if ($perSlot != $this->getPerSlot()) {
      $this->per_slot = $per_slot;
      $this->changed_data[] = 'per_slot';
    }
  }

  public function getNumOfSlots() {
    if (isset($this->number_of_slots) == False) {
      $this->number_of_slots = $this->extractElement('number_of_slots', $this->file->data);
    }
    return $this->number_of_slots;
  }

  public function setNumOfSlots($number_of_slots) {
    $this->number_of_slots = $number_of_slots;
    $this->changed_data[] = 'number_of_slots';
  }

  public function getSlotTime() {
    if (isset($this->slot_time) == False) {
      $this->slot_time = $this->extractElement('slot_time', $this->file->data);
    }
    return $this->slot_time;
  }

  public function setSlotTime($slot_time) {
    $this->slot_time = $slot_time;
    $this->changed_data[] = 'slot_time';
  }

  public function getCalendar() {
    if (isset($this->calendar) == False) {
      $calendar = explode('; ', $this->extractElement('calendar', $this->file->data));
      $d = array();
      foreach ($calendar as $date) {
        $date_times = explode(': ', $date);
        $d[$date_times[0]] = explode(', ', $date_times[1]);
  public function deleteSubject($date, $time, $subject_number) {
    $calendar = $this->getCalendar();
    $subject_email = $calendar[$date][$time][$subject_number][1];
    unset($calendar[$date][$time][$subject_number]);
    if (count($calendar[$date][$time]) == 0) {
      $calendar[$date][$time] = None;
    }
    else {
      $calendar[$date][$time] = array_values($calendar[$date][$time]);<commit_msg>Removed get and setNumOfSlots()<commit_after><?php

class Experiment {

  public function __construct($experiment_id, $write_access=False) {
    global $data_path;
    $this->id = $experiment_id;
    $experiments_file = new File($data_path .'experiments', False);
    $this->owner = $this->extractElement($this->id, $experiments_file->data);
    $this->file = new File($data_path .'user_data/'. $this->owner .'/'. $this->id, $write_access);
    $this->changed_data = array();
  }

  public function saveExperimentData() {
    foreach ($this->changed_data as $parameter) {
      $old_piece = $parameter . ' = {' . $this->extractElement($parameter, $this->file->data) . '}';
      if ($parameter == 'calendar') { $new_piece = $parameter . ' = {' . $this->flattenCalendar() . '}'; }
      else { $new_piece = $parameter . ' = {' . $this->$parameter . '}'; }
      $this->file->data = str_replace($old_piece, $new_piece, $this->file->data);
    }
    return $this->file->overwrite();
  }

  public function getName() {
    if (isset($this->name) == False) {
      $this->name = $this->extractElement('name', $this->file->data);
    }
    return $this->name;
  }

  public function setName($name) {
    if ($name != $this->getName()) {
      $this->name = $name;
      $this->changed_data[] = 'name';
    }
  }

  public function getStatus() {
    if (isset($this->status) == False) {
      $this->status = $this->extractElement('status', $this->file->data);
      if ($this->status == 'open') {
        if (count($this->getAvailableSlots()) == 0) {
          $this->status = 'unavailable';
        }
      }
    }
    return $this->status;
  }

  public function setStatus($status) {
    $this->status = $status;
    $this->changed_data[] = 'status';
  }

  public function getDescription() {
    if (isset($this->description) == False) {
      $this->description = str_replace("\n", '<br />', $this->extractElement('description', $this->file->data));
    }
    return $this->description;
  }

  public function setDescription($description) {
    if ($description != $this->getDescription()) {
      $this->description = $description;
      $this->changed_data[] = 'description';
    }
  }

  public function getLocation() {
    if (isset($this->location) == False) {
      $this->location = $this->extractElement('location', $this->file->data);
    }
    return $this->location;
  }

  public function setLocation($location) {
    if ($location != $this->getLocation()) {
      $this->location = $location;
      $this->changed_data[] = 'location';
    }
  }

  public function getRequirements() {
    if (isset($this->requirements) == False) {
      $this->requirements = explode('; ', $this->extractElement('requirements', $this->file->data));
    }
    return $this->requirements;
  }

  public function setRequirements($requirements) {
    $this->requirements = $requirements;
    $this->changed_data[] = 'requirements';
  }

  public function getExclusions() {
    if (isset($this->exclusions) == False) {
      $this->exclusions = explode('; ', $this->extractElement('exclusions', $this->file->data));
    }
    return $this->exclusions;
  }

  public function setExclusions($exclusions) {
    $this->exclusions = $exclusions;
    $this->changed_data[] = 'exclusions';
  }

  public function getPerSlot() {
    if (isset($this->per_slot) == False) {
      $this->per_slot = $this->extractElement('per_slot', $this->file->data);
    }
    return $this->per_slot;
  }

  public function setPerSlot($per_slot) {
    if ($perSlot != $this->getPerSlot()) {
      $this->per_slot = $per_slot;
      $this->changed_data[] = 'per_slot';
    }
  }

  public function getSlotTime() {
    if (isset($this->slot_time) == False) {
      $this->slot_time = $this->extractElement('slot_time', $this->file->data);
    }
    return $this->slot_time;
  }

  public function setSlotTime($slot_time) {
    $this->slot_time = $slot_time;
    $this->changed_data[] = 'slot_time';
  }

  public function getCalendar() {
    if (isset($this->calendar) == False) {
      $calendar = explode('; ', $this->extractElement('calendar', $this->file->data));
      $d = array();
      foreach ($calendar as $date) {
        $date_times = explode(': ', $date);
        $d[$date_times[0]] = explode(', ', $date_times[1]);
  public function deleteSubject($date, $time, $subject_number) {
    $calendar = $this->getCalendar();
    $subject_email = $calendar[$date][$time][$subject_number][1];
    unset($calendar[$date][$time][$subject_number]);
    if (count($calendar[$date][$time]) == 0) {
      $calendar[$date][$time] = None;
    }
    else {
      $calendar[$date][$time] = array_values($calendar[$date][$time]);
{'fraction_non_alphanumeric': 0.19358486686542614, 'fraction_numerical': 0.0010280662074637606, 'mean_word_length': 3.4057971014492754, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 207, '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': '290162', 'n_tokens_mistral': 3174, 'n_tokens_neox': 3109, 'n_words': 546}