incrementLaps method

Danger<CitrusSymbolTable, CitrusSymbolTableException> incrementLaps(
  1. String temporarySymbolName
)

Implementation

Danger<CitrusSymbolTable, CitrusSymbolTableException> incrementLaps(String temporarySymbolName) {

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

    // 1.
    final getResult = temporarySymbolRoster.getByPrimaryKey(temporarySymbolName);
    log.add(getResult);
    if (getResult is! Success<TemporarySymbol, RosterPatternExceptionB>) return Failure(CitrusSymbolTableExceptionD(), log.monitor({
        'the temporary symbol name does not exist': temporarySymbolName,
        'temporary symbol name list exist': temporarySymbolRoster.nameList,
    }));
    final symbol = getResult.wrapped.increment();

    final updateResult = temporarySymbolRoster.update(symbol);
    log.add(updateResult);
    // 1. より 必ず存在するので CitrusSymbolTableExceptionB を throw out.
    if (updateResult is! Success<CitrusSymbolRoster<TemporarySymbol>, CitrusSymbolExceptionB>) Result.panic(CitrusSymbolTableErrorA(), log);

    // 指定した temporary symbol laps が increment されるだけなので validation は不要.
    final result = CitrusSymbolTable._(this.textSymbolRoster, updateResult.wrapped, this.textArraySymbolRoster, this.fragmentSymbolRoster, this.flagSymbolRoster, this.objectSymbolRoster, this.objectArraySymbolRoster);

    return Success(result, log);

}