code: public final <T extends IInvoice, TL extends AInvTxLn<T>>
      TL findCreateTaxLine(final Map<String, Object> pReqVars, final T pInv,
        final List<TL> pInvTxLns, final Tax pTax, final boolean pNeedFind,
          final IFactorySimple<TL> pFctInvTxLn) throws Exception {
      TL itl = null;
      //find same line to add amount:
      for (TL tl : pInvTxLns) {
        if (tl.getTax() != null
          && tl.getTax().getItsId().equals(pTax.getItsId())) {
          if (!pNeedFind) {
            throw new Exception("Algorithm error!!!");
          }
          itl = tl;
          break;
        }
      }
      //find and enable disabled line:
      for (TL tl : pInvTxLns) {
        if (tl.getTax() == null) {
          itl = tl;
          itl.setTax(pTax);
          break;
        }
      }
      if (itl == null) {
        itl = pFctInvTxLn.create(pReqVars);
        itl.setItsOwner(pInv);
        itl.setIsNew(true);
        itl.setTax(pTax);
        pInvTxLns.add(itl);
      }
      return itl;
    }
docs: <p>Finds (if need) line with same tax or creates one.</p>
  @param <T> invoice type
  @param <TL> invoice tax line type
  @param pReqVars additional param
  @param pInv invoice
  @param pInvTxLns invoice tax lines
  @param pTax tax
  @param pNeedFind if need to find enabled
  @param pFctInvTxLn invoice tax line factory
  @return line
  @throws Exception if no need to find but line is found