class PrependAsPath extends Statement {

  @Override
  public Result execute(Environment environment) {
    List<Long> toPrepend = _expr.evaluate(environment);
    List<AsSet> newAsPaths = toPrepend.stream().map(AsSet::of).collect(Collectors.toList());

    BgpRoute.Builder<?, ?> bgpRouteBuilder = (BgpRoute.Builder<?, ?>) environment.getOutputRoute();
    bgpRouteBuilder.setAsPath(
        AsPath.of(
            ImmutableList.<AsSet>builder()
                .addAll(newAsPaths)
                .addAll(bgpRouteBuilder.getAsPath().getAsSets())
                .build()));

    if (environment.getWriteToIntermediateBgpAttributes()) {
      BgpRoute.Builder<?, ?> ir = environment.getIntermediateBgpAttributes();
      ir.setAsPath(
          AsPath.of(
              ImmutableList.<AsSet>builder()
                  .addAll(newAsPaths)
                  .addAll(ir.getAsPath().getAsSets())
                  .build()));
    }

    Result result = new Result();
    return result;
  }

  public  PrependAsPath(AsPathListExpr expr);

}