<commit_before>#ifndef _Condor_Accountant_H_
#define _Condor_Accountant_H_

#include <iostream.h>

#include "condor_classad.h"

#include "HashTable.h"
#include "MyString.h"
#include "Set.h"
#include "TimeClass.h"

class Accountant {

public:

  //--------------------------------------------------------
  // User Functions
  //--------------------------------------------------------

  void Initialize();  // Initialize some parameters

  double GetPriority(const MyString& CustomerName); // get priority for a customer
  void SetPriority(const MyString& CustomerName, double Priority); // set priority for a customer

  int MatchExist(const MyString& CustomerName, const MyString& ResourceName); // check if a mtch exists
  void AddMatch(const MyString& CustomerName, ClassAd* ResourceAd); // Add new match
  void RemoveMatch(const MyString& ResourceName); // remove a match

  void UpdatePriorities(); // update all the priorities

  void CheckMatches(ClassAdList& ResourceList);  // Remove matches that are not claimed
  AttrList* ReportState();

  //--------------------------------------------------------
  // Misc public functions
  //--------------------------------------------------------

  static int HashFunc(const MyString& Key, int TableSize) {
    int count=0;
    int length=Key.Length();
    for(int i=0; i<length; i++) count+=Key[i];
    return (count % TableSize);
  }
  
  Accountant(int MaxCustomers=1024, int MaxResources=1024);
                                                
private:

  //--------------------------------------------------------
  // Private methods Methods
  //--------------------------------------------------------
  
  void AddMatch(const MyString& CustomerName, const MyString& ResourceName, const Time& T); 
  void RemoveMatch(const MyString& ResourceName, const Time& T);
  void UpdatePriorities(const Time& T);

  void LoadState(); // Save to file
  void SaveState(); // Read from file

  //--------------------------------------------------------
  // Configuration variables
  //--------------------------------------------------------

  double MinPriority;        // Minimum priority (if no resources used)
  double Epsilon;            // used to compare priority to zero
  double HalfLifePeriod;     // The time in sec in which the priority is halved by aging
  MyString LogFileName;      // Name of Log file

  //--------------------------------------------------------
  // Internal data types
  //--------------------------------------------------------

  struct CustomerRecord {
    double Priority;
    double UnchargedTime;
    Set<MyString> ResourceNames;
    CustomerRecord() { Priority=UnchargedTime=0; }
  };<commit_msg>No need for Epsilon<commit_after>#ifndef _Condor_Accountant_H_
#define _Condor_Accountant_H_

#include <iostream.h>

#include "condor_classad.h"

#include "HashTable.h"
#include "MyString.h"
#include "Set.h"
#include "TimeClass.h"

class Accountant {

public:

  //--------------------------------------------------------
  // User Functions
  //--------------------------------------------------------

  void Initialize();  // Initialize some parameters

  double GetPriority(const MyString& CustomerName); // get priority for a customer
  void SetPriority(const MyString& CustomerName, double Priority); // set priority for a customer

  int MatchExist(const MyString& CustomerName, const MyString& ResourceName); // check if a mtch exists
  void AddMatch(const MyString& CustomerName, ClassAd* ResourceAd); // Add new match
  void RemoveMatch(const MyString& ResourceName); // remove a match

  void UpdatePriorities(); // update all the priorities

  void CheckMatches(ClassAdList& ResourceList);  // Remove matches that are not claimed
  AttrList* ReportState();

  //--------------------------------------------------------
  // Misc public functions
  //--------------------------------------------------------

  static int HashFunc(const MyString& Key, int TableSize) {
    int count=0;
    int length=Key.Length();
    for(int i=0; i<length; i++) count+=Key[i];
    return (count % TableSize);
  }
  
  Accountant(int MaxCustomers=1024, int MaxResources=1024);
                                                
private:

  //--------------------------------------------------------
  // Private methods Methods
  //--------------------------------------------------------
  
  void AddMatch(const MyString& CustomerName, const MyString& ResourceName, const Time& T); 
  void RemoveMatch(const MyString& ResourceName, const Time& T);
  void UpdatePriorities(const Time& T);

  void LoadState(); // Save to file
  void SaveState(); // Read from file

  //--------------------------------------------------------
  // Configuration variables
  //--------------------------------------------------------

  double MinPriority;        // Minimum priority (if no resources used)
  double HalfLifePeriod;     // The time in sec in which the priority is halved by aging
  MyString LogFileName;      // Name of Log file

  //--------------------------------------------------------
  // Internal data types
  //--------------------------------------------------------

  struct CustomerRecord {
    double Priority;
    double UnchargedTime;
    Set<MyString> ResourceNames;
    CustomerRecord() { Priority=UnchargedTime=0; }
  };
{'fraction_non_alphanumeric': 0.28885547829355385, 'fraction_numerical': 0.004134561172711896, 'mean_word_length': 1.49624765478424, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3419186', 'n_tokens_mistral': 1275, 'n_tokens_neox': 1208, 'n_words': 401}