docs: protected void addDeterminants(HashMap rule, LinkedHashMap<String, ConTextSpan> matches,
                                     int matchBegin, int currentPosition,
                                     int contextTokenLength) {
          HashMap<String, ?> matchedRules = (HashMap<String, ?>) rule.get(END);
  
  //        int id = (Integer) rule.values().iterator().next();
  //        ContextRule matchedRule = rules.get(id);
  //        Span currentSpan = new Span(matchBegin, i - 1, id);
          for (String key : matchedRules.keySet()) {
              ConTextSpan originalSpan = null;
              int id = (Integer) matchedRules.get(key);
              char matchedDirection = key.charAt(0);
              ContextRule matchedContextRule = getContextRuleById(id);
              ConTextSpan currentSpan = new ConTextSpan(matchBegin, currentPosition - 1, id);
              if (matchedContextRule.triggerType == TriggerTypes.termination) {
                  currentSpan.winBegin = currentSpan.begin;
                  currentSpan.winEnd = currentSpan.end;
              } else {
                  currentSpan.winBegin = currentSpan.begin - rules.get(id).windowSize;
                  currentSpan.winEnd = currentSpan.end + rules.get(id).windowSize;
              }
              currentSpan.matchedDirection = matchedDirection == 'f' ? TriggerTypes.forward : TriggerTypes.backward;
              if (matches.containsKey(key)) {
                  originalSpan = matches.get(key);
                  switch (matchedDirection) {
                      case 'f':
                          if (matchedContextRule.triggerType == TriggerTypes.trigger) {
                              if (originalSpan.winEnd > currentSpan.winEnd ||
                                      (originalSpan.width > currentSpan.width && originalSpan.end >= currentSpan.end) ||
                                      (contextTokenLength - currentSpan.end > getContextRuleById(id).windowSize))
                                  continue;
                              else if (getContextRuleById(originalSpan.ruleId).triggerType == TriggerTypes.termination &&
                                      originalSpan.begin > currentSpan.end) {
                                  continue;
                              }
                          } else if ((originalSpan.begin > currentSpan.end) ||
                                  (originalSpan.width > currentSpan.width && originalSpan.end >= currentSpan.end) ||
                                  (contextTokenLength - currentSpan.end > getContextRuleById(id).windowSize)) {
                              continue;
                          }
                          break;
                      case 'b':
                          if (matchedContextRule.triggerType == TriggerTypes.trigger) {
                              if (originalSpan.winBegin < currentSpan.winBegin ||
                                      (originalSpan.width > currentSpan.width && originalSpan.begin <= currentSpan.begin) ||
                                      (currentSpan.begin > getContextRuleById(id).windowSize))
                                  continue;
                              else if (getContextRuleById(originalSpan.ruleId).triggerType == TriggerTypes.termination &&
                                      originalSpan.end < currentSpan.begin) {
                                  continue;
                              }
                          } else if ((originalSpan.end < currentSpan.begin) ||
                                  (originalSpan.width > currentSpan.width && originalSpan.begin <= currentSpan.begin) ||
                                  (currentSpan.begin > getContextRuleById(id).windowSize)) {
                              continue;
                          }
                          break;
                  }
  
                  ContextRule matchedRule = rules.get(id);
                  //  adjust context window, for later version that support combining modifiers with shared context window terminals
                  if (originalSpan.begin != -1 && (matchedDirection == 'f')) {
                      if (matchedRule.triggerType == TriggerTypes.termination) {
                          currentSpan.winBegin = originalSpan.winBegin > currentSpan.end ? originalSpan.winBegin : currentSpan.end;
                      } else {
                          currentSpan.winBegin = originalSpan.winBegin;
                      }
                  } else if (originalSpan.end != -1 && (matchedDirection == 'b')) {
                      if (matchedRule.triggerType == TriggerTypes.termination) {
                          currentSpan.winEnd = originalSpan.winEnd < currentSpan.winEnd ? originalSpan.winEnd : currentSpan.begin;
                      } else {
                          currentSpan.winEnd = originalSpan.winEnd;
                      }
                  }
              }
              matches.put(key, currentSpan);
          }
  
      }