resolve method

  1. @override
Danger<String, CitrusSemanticException> resolve(
  1. PropertyTable propertyTable
)
override

Implementation

@override
Danger<String, CitrusSemanticException> resolve(PropertyTable propertyTable) {

    final log = Log(classLocation: runtimeType, functionLocation: 'resolve');

    final addTemporaryPropertyResult = propertyTable.addTemporaryProperty(temporaryPropertyName, listPropertyName);
    log.add(addTemporaryPropertyResult);
    if (addTemporaryPropertyResult is! Success<PropertyTable, PropertyTableException>) return Failure(ForBlockSandwichExceptionF(), log);

    final getListLengthResult = propertyTable.getListLength(listPropertyName);
    log.add(getListLengthResult);
    if (getListLengthResult is! Success<int, PropertyTableExceptionE>) return Failure(ForBlockSandwichExceptionF(), log);

    final limit = getListLengthResult.wrapped; // list length. list property name から bound value の length を取得する.
    var count = 1;
    var result = '';
    PropertyTable newPropertyTable = addTemporaryPropertyResult.wrapped;

    while (true) {

        if (count > limit) return Success(result, log);

        final resolveResult = matureCitrusSemanticList.resolve(newPropertyTable);
        log.add(resolveResult);
        if (resolveResult is! Success<String, CitrusSemanticException>) return Failure(resolveResult.asException, log);

        result = result + resolveResult.wrapped;

        // laps を進める.
        final incrementLapsResult = newPropertyTable.incrementLaps(temporaryPropertyName);
        log.add(incrementLapsResult);
        if (incrementLapsResult is! Success<PropertyTable, PropertyTableException>) return Failure(ForBlockSandwichExceptionF(), log);

        newPropertyTable = incrementLapsResult.wrapped;

        count = count + 1;

    }

}