<commit_before>'use strict';
module.exports = class Api {

};<commit_msg>defined and implemented public api<commit_after>'use strict';
let Http = require('./http/http');
let Https = require('./https/https');
let Tcp = require('./tcp/tcp');
let Udp = require('./udp/udp');
let HttpWebSocket = require('./httpWebSocket/httpWebSocket');
let HttpsWebSocket = require('./httpsWebSocket/httpsWebSocket');
let Cluster = require('./cluster/cluster');
let enabledServers = new WeakMap();

module.exports = class Api {

  static createHttpsServer(settings) {
    let server = Https.createServer(settings);
    enabledServers.httpsServer = true;
    return server;
  }  

  static createTcpServer(settings) {
    let server = Tcp.createServer(settings);
    enabledServers.tcpServer = true;
    return server;
  }    

  static createUdpServer(settings) {
    let server = Udp.createServer(settings);
    enabledServers.udpServer = true;
    return server;
  }   

  static createHttpServer(settings) {
    let server = Http.createServer(settings);
    enabledServers.httpServer = true;
    return server;
  }

  static createHttpWebSocket(server) {
    let webSocket = HttpWebSocket.createServer(server);
    enabledServers.httpWebSocket = true;
    return webSocket;
  } 

  static createHttpsWebSocket(server) {
    let webSocket = HttpsWebSocket.createServer(server);
    enabledServers.httpsWebSocket = true;
    return webSocket;
  }   

  static clustering(cores) {
    let servers = {
      http: {
        port: Api.getHttpServerPort(),
        server: Api.getHttpServerInstance()
      },
      https: {
        port: Api.getHttpsServerPort(),
        server: Api.getHttpsServerInstance()       
      },
      httpWebSocket: {
        port: Api.getHttpServerPort(),
        server: Api.getHttpWebSocketInstance()
      },
      httpsWebSocket: {
        port: Api.getHttpsServerPort(),
        server: Api.getHttpsWebSocketInstance()
      }      
    };
    Cluster.enable(servers, cores);
  } 

  static getHttpServerInstance() {
    return Http.getServerInstance();
  } 

  static getHttpsServerInstance() {
    return Https.getServerInstance();    
  } 

  static getHttpWebSocketInstance() {
    return HttpWebSocket.getHttpWebSocketInstance();
  } 

  static getHttpsWebSocketInstance() {
    return HttpsWebSocket.getHttpsWebSocketInstance();    
  }   

  static getUdpServerInstance() {
    return Udp.getServerInstance();        
  } 

  static getTcpServerInstance() {
    return Tcp.getServerInstance();            
  } 

  static getHttpServerPort() {
    return Http.getServerPort();
  } 

  static getHttpsServerPort() {
    return Https.getServerPort();    
  } 

  static getUdpServerPort() {
    return Udp.getServerPort();        
  } 

  static getTcpServerPort() {
    return Tcp.getServerPort();            
  }

};
{'fraction_non_alphanumeric': 0.10962284102925626, 'fraction_numerical': 0.0, 'mean_word_length': 3.071736011477762, 'pattern_counts': {'":': 0, '<': 3, '<?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': '1614083', 'n_tokens_mistral': 875, 'n_tokens_neox': 851, 'n_words': 159}