docs: public TextChunk groupByDirectionality(Boolean isLtrDominant) {
          if (this.getTextElements().size() <= 0) {
              throw new IllegalArgumentException();
          }
  
          ArrayList<ArrayList<TextElement>> chunks = new ArrayList<>();
          ArrayList<TextElement> buff = new ArrayList<>();
          DirectionalityOptions buffDirectionality = DirectionalityOptions.NONE; // the directionality of the characters in buff;
  
          for (TextElement te : this.getTextElements()) {
              //TODO: we need to loop over the textelement characters
              //      because it is possible for a textelement to contain multiple characters?
  
  
              // System.out.println(te.getText() + " is " + Character.getDirectionality(te.getText().charAt(0) ) + " " + directionalities.get(Character.getDirectionality(te.getText().charAt(0) )));
              if (buff.size() == 0) {
                  buff.add(te);
                  buffDirectionality = directionalities.get(Character.getDirectionality(te.getText().charAt(0)));
              } else {
                  if (buffDirectionality == DirectionalityOptions.NONE) {
                      buffDirectionality = directionalities.get(Character.getDirectionality(te.getText().charAt(0)));
                  }
                  DirectionalityOptions teDirectionality = directionalities.get(Character.getDirectionality(te.getText().charAt(0)));
  
                  if (teDirectionality == buffDirectionality || teDirectionality == DirectionalityOptions.NONE) {
                      if (Character.getDirectionality(te.getText().charAt(0)) == java.lang.Character.DIRECTIONALITY_WHITESPACE && (buffDirectionality == (isLtrDominant ? DirectionalityOptions.RTL : DirectionalityOptions.LTR))) {
                          buff.add(0, te);
                      } else {
                          buff.add(te);
                      }
                  } else {
                      // finish this chunk
                      if (buffDirectionality == DirectionalityOptions.RTL) {
                          Collections.reverse(buff);
                      }
                      chunks.add(buff);
  
                      // and start a new one
                      buffDirectionality = directionalities.get(Character.getDirectionality(te.getText().charAt(0)));
                      buff = new ArrayList<>();
                      buff.add(te);
                  }
              }
          }
          if (buffDirectionality == DirectionalityOptions.RTL) {
              Collections.reverse(buff);
          }
          chunks.add(buff);
          ArrayList<TextElement> everything = new ArrayList<>();
          if (!isLtrDominant) {
              Collections.reverse(chunks);
          }
          for (ArrayList<TextElement> group : chunks) {
              everything.addAll(group);
          }
          return new TextChunk(everything);
      }