<commit_before>
package com.github.airutech.cnets.runnablesContainer;

/*[[[cog
import cogging as c
c.tpl(cog,templateFile,c.a(prefix=configFile))
]]]*/

import com.github.airutech.cnets.types.*;
public class runnablesContainer{
  
  public runnablesContainer(){
    onCreate();
    initialize();
  }

  private void initialize(){
    
    onKernels();
    
  }
/*[[[end]]] (checksum: d3aa07db72ddfd84eb24c3a0afb195e6)*/

  private void onKernels() {

  }

  private void onCreate(){

  }

  private Kernel kernel = null;
  private runnablesContainer[] containers = null;
  private RunnableStoppable target = null;

  public void setContainers(runnablesContainer[] containers){
    this.containers = containers;
  }

  public void setCore(RunnableStoppable target){
    this.target = target;
  }

  public void launch(boolean lockLastElement){
    if(target!=null){
      kernel = new Kernel();
      kernel.launch(target, lockLastElement);
    }else if(containers!=null){
      for(int i=0;i<containers.length - 1;i++){
        containers[i].launch(false);
      }
      containers[containers.length - 1].launch(lockLastElement);
    }
  }

  public void stop(){
    if(target!=null){
      if(kernel!=null) {
        kernel.stopThread();
        kernel = null;
      }
    }else if(containers!=null){
      for(int i=containers.length-1;i>=0;i--){
        containers[i].stop();
      }
    }
  }
}

<commit_msg>allow to implement 3rd party launchers/stoppers<commit_after>
package com.github.airutech.cnets.runnablesContainer;

/*[[[cog
import cogging as c
c.tpl(cog,templateFile,c.a(prefix=configFile))
]]]*/

import com.github.airutech.cnets.types.*;
public class runnablesContainer{
  
  public runnablesContainer(){
    onCreate();
    initialize();
  }

  private void initialize(){
    
    onKernels();
    
  }
/*[[[end]]] (checksum: d3aa07db72ddfd84eb24c3a0afb195e6)*/

  private void onKernels() {

  }

  private void onCreate(){

  }

  private Kernel kernel = null;
  private runnablesContainer[] containers = null;
  private RunnableStoppable target = null;



  public void setContainers(runnablesContainer[] containers){
    this.containers = containers;
  }

/*getTarget and getContainers allow third-party libraries to implement launch-stop algorithms*/
  public RunnableStoppable getTarget(){return target;}
  public runnablesContainer[] getContainers(){if(target!=null){return new runnablesContainer[]{this};}else{return containers;}}
/**/

  public void setCore(RunnableStoppable target){
    this.target = target;
  }

  public void launch(boolean lockLastElement){
    if(target!=null){
      kernel = new Kernel();
      kernel.launch(target, lockLastElement);
    }else if(containers!=null){
      for(int i=0;i<containers.length - 1;i++){
        containers[i].launch(false);
      }
      containers[containers.length - 1].launch(lockLastElement);
    }
  }

  public void stop(){
    if(target!=null){
      if(kernel!=null) {
        kernel.stopThread();
        kernel = null;
      }
    }else if(containers!=null){
      for(int i=containers.length-1;i>=0;i--){
        containers[i].stop();
      }
    }
  }
}


{'fraction_non_alphanumeric': 0.13600254210359072, 'fraction_numerical': 0.013028280902446775, 'mean_word_length': 3.415147265077139, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5533469', 'n_tokens_mistral': 1071, 'n_tokens_neox': 1027, 'n_words': 197}