highValue function

List<String> highValue(
  1. List<Map<String, String>> _inlM,
  2. int _c,
  3. int _w
)

QUEST: there is surely better algorithm for this Gets some small data from effortLM based on parameters.

Implementation

List<String> highValue(List<Map<String, String>> _inlM, int _c, int _w) {
  print('-->>-->>getRecommendation in effort  -->>-->>-- ');
  //  _w parameter is for KEY field width.
  //  TODO  add width check / repair for too long _w value
  List<String> _retL = [];

  for (var x = 0; x < _inlM.length; x++) {
    for (var y in _inlM[x].keys) {
      //  howTo NULL int
      //  NO   int iVPos! = _inlM[x][y].indexOf('V:');
      int iVPos = 0;
      iVPos =_inlM[x][y]!.indexOf('V:');

      int iEPos = _inlM[x][y]!.indexOf('E:');

      int iVal = -1;
      int iEff = -1;
      //  check if we got 2 numbers.
      //  howTo NULL int
      String checkS = _inlM[x][y]!.substring(iVPos + 2, iVPos + 3);
      if (tl.isNumber(checkS)) {
        iVal = int.parse(_inlM[x][y]!.substring(iVPos + 2, iVPos + 3));
        String checkS = _inlM[x][y]!.substring(iEPos + 2, iEPos + 3);
        if (tl.isNumber(checkS)) {
          iEff = int.parse(_inlM[x][y]!.substring(iEPos + 2, iEPos + 3));

          //  check for high value-effort coefficient.
          //  copy positive-value-efforts to new map
          if ((iVal - iEff) > 0) {
            //  3 ?
            //  print('------------ iVal - iEff > 0 -----------------------');
            String _s1 = y.substring(0, _w); // Map key of _w width.
            ///  Copy  :  V:3 E:9  like string.
            String _s2 = _inlM[x][y]!.substring(iVPos, iVPos + 3);
            String _s3 = _inlM[x][y]!.substring(iEPos, iEPos + 3);
            String _sAdd = ('$_s1 $_s2 $_s3');
            _retL.add(_sAdd); //  like:  PhaseDone V:9 E:8
          }
        }
      } //  --  tl.isNumber(checkS)
    } //  --  for (var y in _inlM[x].keys)
  }
  //  _retL.forEach(print);
  List<String> _retLTake = [];
  //  take _c items as asked in parameter.
  //  TODO  Count check _c > _retL.length
  _retLTake.addAll(_retL.take(_c));
  //  might use:  _retL.takeWhile(  bool  );
  print('-->>-->>getRecommendation callled highValue in shower  -->>-->>-- ');
  print('returning list:: n-values:  $_c ');
  _retLTake.forEach(print);
  return _retLTake;
}