Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 
 package rinde.sim.pdptw.central;
 
 import static com.google.common.collect.Lists.newArrayList;
 import static java.util.Collections.unmodifiableList;
 
 import java.util.List;
Allows keeping track of the inputs and outputs of a Solver.

Author(s):
Rinde van Lon <rinde.vanlon@cs.kuleuven.be>
public final class SolverDebugger implements Solver {
  private final List<GlobalStateObjectinputs;
  private final Solver delegate;
  private final boolean print;
  private SolverDebugger(Solver delegateboolean debugPrints) {
    this. = delegate;
     = debugPrints;
     = newArrayList();
     = newArrayList();
  }
    if () {
      ..println(state);
    }
    .add(state);
    final ImmutableList<ImmutableList<ParcelDTO>> result = 
        .solve(state);
    .add(result);
    if () {
      ..println(result);
    }
    return result;
  }

  

Returns:
An unmodifiable view on the inputs that were used when calling solve(rinde.sim.pdptw.central.GlobalStateObject). The list is in order of invocation.
    return unmodifiableList();
  }

  

Returns:
An unmodifiable view on the outputs that are generated when calling solve(rinde.sim.pdptw.central.GlobalStateObject). The list is in order of invocation.
    return unmodifiableList();
  }

  
Wraps the specified solver in a SolverDebugger instance to allow easier debugging of a solver.

Parameters:
s The solver to wrap.
print Whether debug printing should be enabled.
Returns:
The wrapped solver.
  public static SolverDebugger wrap(Solver sboolean print) {
    return new SolverDebugger(sprint);
  }
New to GrepCode? Check out our FAQ X