nus-yam/ex-repair huggingface dataset:
Program: 57170
Project: 57170
Buggy source:
/** 
 * Optimize an objective function. Optimization is considered to be a weighted least-squares minimization. The cost function to be minimized is <code>&sum;weight<sub>i</sub>(objective<sub>i</sub> - target<sub>i</sub>)<sup>2</sup></code>
 * @param maxEval Allowed number of evaluations of the objective function.
 * @param f Objective function.
 * @param optData Optimization data. The following data will be looked for:<ul> <li> {@link Target}</li> <li>  {@link Weight}</li> <li>  {@link InitialGuess}</li> </ul>
 * @return the point/value pair giving the optimal value of the objectivefunction.
 * @throws org.apache.commons.math3.exception.TooManyEvaluationsException ifthe maximal number of evaluations is exceeded.
 * @throws DimensionMismatchException if the target, and weight argumentshave inconsistent dimensions.
 * @see BaseAbstractMultivariateVectorOptimizer#optimizeInternal(int,MultivariateVectorFunction,OptimizationData[])
 * @since 3.1
 * @deprecated As of 3.1. Override is necessary only until this class's genericargument is changed to  {@code MultivariateDifferentiableVectorFunction}.
 */
@Deprecated protected PointVectorValuePair optimizeInternal(final int maxEval,final MultivariateDifferentiableVectorFunction f,OptimizationData... optData){
  return super.optimizeInternal(maxEval,FunctionUtils.toDifferentiableMultivariateVectorFunction(f),optData);
}

Fixed version (ground truth):
/** 
 * Optimize an objective function. Optimization is considered to be a weighted least-squares minimization. The cost function to be minimized is <code>&sum;weight<sub>i</sub>(objective<sub>i</sub> - target<sub>i</sub>)<sup>2</sup></code>
 * @param maxEval Allowed number of evaluations of the objective function.
 * @param f Objective function.
 * @param optData Optimization data. The following data will be looked for:<ul> <li> {@link Target}</li> <li>  {@link Weight}</li> <li>  {@link InitialGuess}</li> </ul>
 * @return the point/value pair giving the optimal value of the objectivefunction.
 * @throws org.apache.commons.math3.exception.TooManyEvaluationsException ifthe maximal number of evaluations is exceeded.
 * @throws DimensionMismatchException if the target, and weight argumentshave inconsistent dimensions.
 * @see BaseAbstractMultivariateVectorOptimizer#optimizeInternal(int,org.apache.commons.math3.analysis.MultivariateVectorFunction,OptimizationData[])
 * @since 3.1
 * @deprecated As of 3.1. Override is necessary only until this class's genericargument is changed to  {@code MultivariateDifferentiableVectorFunction}.
 */
@Deprecated protected PointVectorValuePair optimizeInternal(final int maxEval,final MultivariateDifferentiableVectorFunction f,OptimizationData... optData){
  return super.optimizeInternal(maxEval,FunctionUtils.toDifferentiableMultivariateVectorFunction(f),optData);
}
Program: 57172
Project: 57172
Buggy source:
public RealVector getPoint(){
  return this.point;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public RealVector getPoint(){
  return this.point;
}
Program: 57173
Project: 57173
Buggy source:
public int getObservationSize(){
  return target.getDimension();
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public int getObservationSize(){
  return target.getDimension();
}
Program: 57174
Project: 57174
Buggy source:
public RealVector getStart(){
  return start == null ? null : start.copy();
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public RealVector getStart(){
  return start == null ? null : start.copy();
}
Program: 57175
Project: 57175
Buggy source:
public int getParameterSize(){
  return start.getDimension();
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public int getParameterSize(){
  return start.getDimension();
}
Program: 57176
Project: 57176
Buggy source:
private UnweightedEvaluation(final RealVector values,final RealMatrix jacobian,final RealVector target,final RealVector point){
  super(target.getDimension());
  this.values=values;
  this.jacobian=jacobian;
  this.target=target;
  this.point=point;
}

Fixed version (ground truth):
/** 
 * Create an   {@link Evaluation} with no weights.
 * @param values   the computed function values
 * @param jacobian the computed function Jacobian
 * @param target   the observed values
 * @param point    the abscissa
 */
private UnweightedEvaluation(final RealVector values,final RealMatrix jacobian,final RealVector target,final RealVector point){
  super(target.getDimension());
  this.values=values;
  this.jacobian=jacobian;
  this.target=target;
  this.point=point;
}
Program: 57177
Project: 57177
Buggy source:
LeastSquaresProblemImpl(final MultivariateJacobianFunction model,final RealVector target,final RealVector start,final ConvergenceChecker<Evaluation> checker,final int maxEvaluations,final int maxIterations){
  super(maxEvaluations,maxIterations,checker);
  this.target=target;
  this.model=model;
  this.start=start;
}

Fixed version (ground truth):
/** 
 * Create a   {@link LeastSquaresProblem} from the given data.
 * @param model          the model function
 * @param target         the observed data
 * @param start          the initial guess
 * @param checker        the convergence checker
 * @param maxEvaluations the allowed evaluations
 * @param maxIterations  the allowed iterations
 */
LeastSquaresProblemImpl(final MultivariateJacobianFunction model,final RealVector target,final RealVector start,final ConvergenceChecker<Evaluation> checker,final int maxEvaluations,final int maxIterations){
  super(maxEvaluations,maxIterations,checker);
  this.target=target;
  this.model=model;
  this.start=start;
}
Program: 57178
Project: 57178
Buggy source:
public RealVector computeValue(){
  return this.values;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public RealVector computeValue(){
  return this.values;
}
Program: 57179
Project: 57179
Buggy source:
public RealVector computeResiduals(){
  return target.subtract(this.computeValue());
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public RealVector computeResiduals(){
  return target.subtract(this.computeValue());
}
Program: 57180
Project: 57180
Buggy source:
public Evaluation evaluate(final RealVector point){
  final Pair<RealVector,RealMatrix> value=this.model.value(point);
  return new UnweightedEvaluation(value.getFirst(),value.getSecond(),this.target,point);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public Evaluation evaluate(final RealVector point){
  final Pair<RealVector,RealMatrix> value=this.model.value(point);
  return new UnweightedEvaluation(value.getFirst(),value.getSecond(),this.target,point);
}
Program: 57181
Project: 57181
Buggy source:
public RealMatrix computeJacobian(){
  return this.jacobian;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public RealMatrix computeJacobian(){
  return this.jacobian;
}
Program: 57182
Project: 57182
Buggy source:
/** 
 * Get a independent Incrementor that counts up to   {@link #getMaxEvaluations()} andthen throws an exception.
 * @return a counter for the evaluations.
 */
Incrementor getEvaluationCounter();

Fixed version (ground truth):
/** 
 * Get a independent Incrementor that counts up to the maximum number of evaluations and then throws an exception.
 * @return a counter for the evaluations.
 */
Incrementor getEvaluationCounter();
Program: 57183
Project: 57183
Buggy source:
/** 
 * Get a independent Incrementor that counts up to   {@link #getMaxIterations()} andthen throws an exception.
 * @return a counter for the evaluations.
 */
Incrementor getIterationCounter();

Fixed version (ground truth):
/** 
 * Get a independent Incrementor that counts up to the maximum number of iterations and then throws an exception.
 * @return a counter for the evaluations.
 */
Incrementor getIterationCounter();
Program: 57184
Project: 57184
Buggy source:
public Incrementor getEvaluationCounter(){
  return new Incrementor(this.maxEvaluations,MAX_EVAL_CALLBACK);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public Incrementor getEvaluationCounter(){
  return new Incrementor(this.maxEvaluations,MAX_EVAL_CALLBACK);
}
Program: 57185
Project: 57185
Buggy source:
public ConvergenceChecker<PAIR> getConvergenceChecker(){
  return checker;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public ConvergenceChecker<PAIR> getConvergenceChecker(){
  return checker;
}
Program: 57186
Project: 57186
Buggy source:
protected AbstractOptimizationProblem(final int maxEvaluations,final int maxIterations,final ConvergenceChecker<PAIR> checker){
  this.maxEvaluations=maxEvaluations;
  this.maxIterations=maxIterations;
  this.checker=checker;
}

Fixed version (ground truth):
/** 
 * Create an   {@link AbstractOptimizationProblem} from the given data.
 * @param maxEvaluations the number of allowed model function evaluations.
 * @param maxIterations  the number of allowed iterations.
 * @param checker        the convergence checker.
 */
protected AbstractOptimizationProblem(final int maxEvaluations,final int maxIterations,final ConvergenceChecker<PAIR> checker){
  this.maxEvaluations=maxEvaluations;
  this.maxIterations=maxIterations;
  this.checker=checker;
}
Program: 57187
Project: 57187
Buggy source:
public Incrementor getIterationCounter(){
  return new Incrementor(this.maxIterations,MAX_ITER_CALLBACK);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public Incrementor getIterationCounter(){
  return new Incrementor(this.maxIterations,MAX_ITER_CALLBACK);
}
Program: 57188
Project: 57188
Buggy source:
/** 
 * Fits a curve. This method computes the coefficients of the curve that best fit the sample of observed points.
 * @param points Observations.
 * @return the fitted parameters.
 */
public double[] fit(Collection<WeightedObservedPoint> points){
  return getOptimizer().optimize(getProblem(points)).getPoint();
}

Fixed version (ground truth):
/** 
 * Fits a curve. This method computes the coefficients of the curve that best fit the sample of observed points.
 * @param points Observations.
 * @return the fitted parameters.
 */
public double[] fit(Collection<WeightedObservedPoint> points){
  return getOptimizer().optimize(getProblem(points)).getPoint().toArray();
}
Program: 57189
Project: 57189
Buggy source:
/** 
 * {@inheritDoc} 
 */
@Override protected LeastSquaresProblem getProblem(Collection<WeightedObservedPoint> observations){
  final int len=observations.size();
  final double[] target=new double[len];
  final double[] weights=new double[len];
  int i=0;
  for (  WeightedObservedPoint obs : observations) {
    target[i]=obs.getY();
    weights[i]=obs.getWeight();
    ++i;
  }
  final AbstractCurveFitter.TheoreticalValuesFunction model=new AbstractCurveFitter.TheoreticalValuesFunction(FUNCTION,observations);
  final double[] startPoint=initialGuess != null ? initialGuess : new ParameterGuesser(observations).guess();
  return new LeastSquaresBuilder().maxEvaluations(Integer.MAX_VALUE).maxIterations(maxIter).start(startPoint).target(target).weight(new DiagonalMatrix(weights)).model(model.getModelFunction()).jacobian(model.getModelFunctionJacobian()).build();
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
@Override protected LeastSquaresProblem getProblem(Collection<WeightedObservedPoint> observations){
  final int len=observations.size();
  final double[] target=new double[len];
  final double[] weights=new double[len];
  int i=0;
  for (  WeightedObservedPoint obs : observations) {
    target[i]=obs.getY();
    weights[i]=obs.getWeight();
    ++i;
  }
  final AbstractCurveFitter.TheoreticalValuesFunction model=new AbstractCurveFitter.TheoreticalValuesFunction(FUNCTION,observations);
  final double[] startPoint=initialGuess != null ? initialGuess : new ParameterGuesser(observations).guess();
  return new LeastSquaresBuilder().maxEvaluations(Integer.MAX_VALUE).maxIterations(maxIter).start(startPoint).target(target).weight(new DiagonalMatrix(weights)).model(model.getModelFunction(),model.getModelFunctionJacobian()).build();
}
Program: 57190
Project: 57190
Buggy source:
/** 
 * {@inheritDoc} 
 */
@Override protected LeastSquaresProblem getProblem(Collection<WeightedObservedPoint> observations){
  final int len=observations.size();
  final double[] target=new double[len];
  final double[] weights=new double[len];
  int i=0;
  for (  WeightedObservedPoint obs : observations) {
    target[i]=obs.getY();
    weights[i]=obs.getWeight();
    ++i;
  }
  final AbstractCurveFitter.TheoreticalValuesFunction model=new AbstractCurveFitter.TheoreticalValuesFunction(FUNCTION,observations);
  final double[] startPoint=initialGuess != null ? initialGuess : new ParameterGuesser(observations).guess();
  return new LeastSquaresBuilder().maxEvaluations(Integer.MAX_VALUE).maxIterations(maxIter).start(startPoint).target(target).weight(new DiagonalMatrix(weights)).model(model.getModelFunction()).jacobian(model.getModelFunctionJacobian()).build();
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
@Override protected LeastSquaresProblem getProblem(Collection<WeightedObservedPoint> observations){
  final int len=observations.size();
  final double[] target=new double[len];
  final double[] weights=new double[len];
  int i=0;
  for (  WeightedObservedPoint obs : observations) {
    target[i]=obs.getY();
    weights[i]=obs.getWeight();
    ++i;
  }
  final AbstractCurveFitter.TheoreticalValuesFunction model=new AbstractCurveFitter.TheoreticalValuesFunction(FUNCTION,observations);
  final double[] startPoint=initialGuess != null ? initialGuess : new ParameterGuesser(observations).guess();
  return new LeastSquaresBuilder().maxEvaluations(Integer.MAX_VALUE).maxIterations(maxIter).start(startPoint).target(target).weight(new DiagonalMatrix(weights)).model(model.getModelFunction(),model.getModelFunctionJacobian()).build();
}
Program: 57191
Project: 57191
Buggy source:
/** 
 * {@inheritDoc} 
 */
@Override protected LeastSquaresProblem getProblem(Collection<WeightedObservedPoint> observations){
  final int len=observations.size();
  final double[] target=new double[len];
  final double[] weights=new double[len];
  int i=0;
  for (  WeightedObservedPoint obs : observations) {
    target[i]=obs.getY();
    weights[i]=obs.getWeight();
    ++i;
  }
  final AbstractCurveFitter.TheoreticalValuesFunction model=new AbstractCurveFitter.TheoreticalValuesFunction(FUNCTION,observations);
  if (initialGuess == null) {
    throw new MathInternalError();
  }
  return new LeastSquaresBuilder().maxEvaluations(Integer.MAX_VALUE).maxIterations(maxIter).start(initialGuess).target(target).weight(new DiagonalMatrix(weights)).model(model.getModelFunction()).jacobian(model.getModelFunctionJacobian()).build();
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
@Override protected LeastSquaresProblem getProblem(Collection<WeightedObservedPoint> observations){
  final int len=observations.size();
  final double[] target=new double[len];
  final double[] weights=new double[len];
  int i=0;
  for (  WeightedObservedPoint obs : observations) {
    target[i]=obs.getY();
    weights[i]=obs.getWeight();
    ++i;
  }
  final AbstractCurveFitter.TheoreticalValuesFunction model=new AbstractCurveFitter.TheoreticalValuesFunction(FUNCTION,observations);
  if (initialGuess == null) {
    throw new MathInternalError();
  }
  return new LeastSquaresBuilder().maxEvaluations(Integer.MAX_VALUE).maxIterations(maxIter).start(initialGuess).target(target).weight(new DiagonalMatrix(weights)).model(model.getModelFunction(),model.getModelFunctionJacobian()).build();
}
Program: 57192
Project: 57192
Buggy source:
/** 
 * Computes an estimate of the standard deviation of the parameters. The returned values are the square root of the diagonal coefficients of the covariance matrix,   {@code sd(a[i]) ~= sqrt(C[i][i])}, where   {@code a[i]} is the optimizedvalue of the  {@code i}-th parameter, and   {@code C} is the covariance matrix.
 * @param covarianceSingularityThreshold Singularity threshold (see {@link #computeCovariances(double[],double) computeCovariances}).
 * @return an estimate of the standard deviation of the optimized parameters
 * @throws org.apache.commons.math3.linear.SingularMatrixException if the covariance matrix cannot be computed.
 */
double[] computeSigma(double covarianceSingularityThreshold);

Fixed version (ground truth):
/** 
 * Computes an estimate of the standard deviation of the parameters. The returned values are the square root of the diagonal coefficients of the covariance matrix,   {@code sd(a[i]) ~= sqrt(C[i][i])}, where   {@code a[i]} is the optimizedvalue of the  {@code i}-th parameter, and   {@code C} is the covariance matrix.
 * @param covarianceSingularityThreshold Singularity threshold (see {@link #computeCovariances(double) computeCovariances}).
 * @return an estimate of the standard deviation of the optimized parameters
 * @throws org.apache.commons.math3.linear.SingularMatrixException if the covariance matrix cannot be computed.
 */
double[] computeSigma(double covarianceSingularityThreshold);
Program: 57193
Project: 57193
Buggy source:
/** 
 * Computes the objective (model) function value.
 * @return the objective function value at the specified point.
 * @throws org.apache.commons.math3.exception.TooManyEvaluationsException if the maximal number of evaluations (of the model vector function) is exceeded.
 */
double[] computeValue();

Fixed version (ground truth):
/** 
 * Computes the objective (model) function value.
 * @return the objective function value at the specified point.
 */
double[] computeValue();
Program: 57194
Project: 57194
Buggy source:
/** 
 * Computes the weighted residuals. The residual is the difference between the observed (target) values and the model (objective function) value. There is one residual for each element of the vector-valued function. The raw residuals are then multiplied by the square root of the weight matrix.
 * @return the weighted residuals: W<sup>1/2</sup> K.
 * @throws DimensionMismatchException if {@code params} has a wrong length.
 */
double[] computeResiduals();

Fixed version (ground truth):
/** 
 * Computes the weighted residuals. The residual is the difference between the observed (target) values and the model (objective function) value. There is one residual for each element of the vector-valued function. The raw residuals are then multiplied by the square root of the weight matrix.
 * @return the weighted residuals: W<sup>1/2</sup> K.
 * @throws DimensionMismatchException if the residuals have the wrong length.
 */
double[] computeResiduals();
Program: 57195
Project: 57195
Buggy source:
/** 
 * Evaluate the model at the specified point.
 * @param point the parameter values.
 * @return the model's value and derivative at the given point.
 */
Evaluation evaluate(double[] point);

Fixed version (ground truth):
/** 
 * Evaluate the model at the specified point.
 * @param point the parameter values.
 * @return the model's value and derivative at the given point.
 * @throws org.apache.commons.math3.exception.TooManyEvaluationsException if the maximal number of evaluations (of the model vector function) is exceeded.
 */
Evaluation evaluate(double[] point);
Program: 57196
Project: 57196
Buggy source:
/** 
 * Computes the cost.
 * @return the cost.
 * @see #computeResiduals(double[])
 */
double computeCost();

Fixed version (ground truth):
/** 
 * Computes the cost.
 * @return the cost.
 * @see #computeResiduals()
 */
double computeCost();
Program: 57197
Project: 57197
Buggy source:
/** 
 * Create a split part.
 * @param tree BSP tree containing the limit angles of the split part
 * @return split part (may be null)
 */
private ArcsSet createSplitPart(final BSPTree<Sphere1D> tree){
  if (tree.getCut() == null && !(Boolean)tree.getAttribute()) {
    return null;
  }
 else {
    return new ArcsSet(tree,getTolerance());
  }
}

Fixed version (ground truth):
/** 
 * Create a split part. <p> As per construction, the list of limit angles is known to have an even number of entries, with start angles at even indices and end angles at odd indices. </p>
 * @param limits limit angles of the split part
 * @return split part (may be null)
 */
private ArcsSet createSplitPart(final List<Double> limits){
  if (limits.isEmpty()) {
    return null;
  }
 else {
    for (int i=0; i < limits.size(); ++i) {
      final int j=(i + 1) % limits.size();
      final double lA=limits.get(i);
      final double lB=MathUtils.normalizeAngle(limits.get(j),lA);
      if (FastMath.abs(lB - lA) <= getTolerance()) {
        if (j > 0) {
          limits.remove(j);
          limits.remove(i);
          i=i - 1;
        }
 else {
          final double lEnd=limits.remove(limits.size() - 1);
          final double lStart=limits.remove(0);
          if (limits.isEmpty()) {
            if (lEnd - lStart > FastMath.PI) {
              return new ArcsSet(new BSPTree<Sphere1D>(Boolean.TRUE),getTolerance());
            }
 else {
              return null;
            }
          }
 else {
            limits.add(limits.remove(0) + MathUtils.TWO_PI);
          }
        }
      }
    }
    BSPTree<Sphere1D> tree=new BSPTree<Sphere1D>(Boolean.FALSE);
    for (int i=0; i < limits.size() - 1; i+=2) {
      addArcLimit(tree,limits.get(i),true);
      addArcLimit(tree,limits.get(i + 1),false);
    }
    if (tree.getCut() == null) {
      return null;
    }
    return new ArcsSet(tree,getTolerance());
  }
}
Program: 57199
Project: 57199
Buggy source:
/** 
 * Add an arc limit to a BSP tree under construction.
 * @param tree BSP tree under construction
 * @param alpha arc limit
 * @param isStart if true, the limit is the start of an arc
 */
private void addArcLimit(final BSPTree<Sphere1D> tree,final double alpha,final boolean isStart){
  final LimitAngle limit=new LimitAngle(new S1Point(alpha),!isStart,getTolerance());
  final BSPTree<Sphere1D> node=tree.getCell(limit.getLocation(),getTolerance());
  if (node.getCut() != null) {
    leafBefore(node).setAttribute(Boolean.valueOf(!isStart));
  }
 else {
    node.insertCut(limit);
    node.setAttribute(null);
    node.getPlus().setAttribute(Boolean.FALSE);
    node.getMinus().setAttribute(Boolean.TRUE);
  }
}

Fixed version (ground truth):
/** 
 * Add an arc limit to a BSP tree under construction.
 * @param tree BSP tree under construction
 * @param alpha arc limit
 * @param isStart if true, the limit is the start of an arc
 */
private void addArcLimit(final BSPTree<Sphere1D> tree,final double alpha,final boolean isStart){
  final LimitAngle limit=new LimitAngle(new S1Point(alpha),!isStart,getTolerance());
  final BSPTree<Sphere1D> node=tree.getCell(limit.getLocation(),getTolerance());
  if (node.getCut() != null) {
    throw new MathInternalError();
  }
  node.insertCut(limit);
  node.setAttribute(null);
  node.getPlus().setAttribute(Boolean.FALSE);
  node.getMinus().setAttribute(Boolean.TRUE);
}
Program: 57200
Project: 57200
Buggy source:
/** 
 * Compute the relative position of the instance with respect to an arc. <p> The   {@link Side#MINUS} side of the arc is the one covered by the arc.</p>
 * @param arc arc to check instance against
 * @return one of {@link Side#PLUS},   {@link Side#MINUS},   {@link Side#BOTH}or   {@link Side#HYPER}
 */
public Side side(final Arc arc){
  final double reference=FastMath.PI + arc.getInf();
  final double arcLength=arc.getSup() - arc.getInf();
  boolean inMinus=false;
  boolean inPlus=false;
  for (  final double[] a : this) {
    final double syncedStart=MathUtils.normalizeAngle(a[0],reference) - arc.getInf();
    final double arcOffset=a[0] - syncedStart;
    final double syncedEnd=a[1] - arcOffset;
    if (syncedStart < arcLength || syncedEnd > MathUtils.TWO_PI) {
      inMinus=true;
    }
    if (syncedEnd > arcLength) {
      inPlus=true;
    }
  }
  if (inMinus) {
    if (inPlus) {
      return Side.BOTH;
    }
 else {
      return Side.MINUS;
    }
  }
 else {
    if (inPlus) {
      return Side.PLUS;
    }
 else {
      return Side.HYPER;
    }
  }
}

Fixed version (ground truth):
/** 
 * Compute the relative position of the instance with respect to an arc. <p> The   {@link Side#MINUS} side of the arc is the one covered by the arc.</p>
 * @param arc arc to check instance against
 * @return one of {@link Side#PLUS},   {@link Side#MINUS},   {@link Side#BOTH}or   {@link Side#HYPER}
 */
public Side side(final Arc arc){
  final double reference=FastMath.PI + arc.getInf();
  final double arcLength=arc.getSup() - arc.getInf();
  boolean inMinus=false;
  boolean inPlus=false;
  for (  final double[] a : this) {
    final double syncedStart=MathUtils.normalizeAngle(a[0],reference) - arc.getInf();
    final double arcOffset=a[0] - syncedStart;
    final double syncedEnd=a[1] - arcOffset;
    if (syncedStart <= arcLength - getTolerance() || syncedEnd >= MathUtils.TWO_PI + getTolerance()) {
      inMinus=true;
    }
    if (syncedEnd >= arcLength + getTolerance()) {
      inPlus=true;
    }
  }
  if (inMinus) {
    if (inPlus) {
      return Side.BOTH;
    }
 else {
      return Side.MINUS;
    }
  }
 else {
    if (inPlus) {
      return Side.PLUS;
    }
 else {
      return Side.HYPER;
    }
  }
}
Program: 57201
Project: 57201
Buggy source:
/** 
 * Simple constructor.
 */
public SubArcsIterator(){
  firstStart=getFirstArcStart();
  current=firstStart;
  if (firstStart == null) {
    if ((Boolean)getTree(false).getAttribute()) {
      pending=new double[]{0,MathUtils.TWO_PI};
    }
 else {
      pending=null;
    }
  }
 else {
    selectPending();
  }
}

Fixed version (ground truth):
/** 
 * Simple constructor.
 */
public SubArcsIterator(){
  firstStart=getFirstArcStart();
  current=firstStart;
  if (firstStart == null) {
    if ((Boolean)getFirstLeaf(getTree(false)).getAttribute()) {
      pending=new double[]{0,MathUtils.TWO_PI};
    }
 else {
      pending=null;
    }
  }
 else {
    selectPending();
  }
}
Program: 57202
Project: 57202
Buggy source:
/** 
 * {@inheritDoc} 
 */
public void visitInternalNode(final BSPTree<Sphere2D> node){
  nodeToEdgesList.put(node,new ArrayList<Edge>());
  @SuppressWarnings("String_Node_Str") final BoundaryAttribute<Sphere2D> attribute=(BoundaryAttribute<Sphere2D>)node.getAttribute();
  if (attribute.getPlusOutside() != null) {
    addContribution((SubCircle)attribute.getPlusOutside(),false,node);
  }
  if (attribute.getPlusInside() != null) {
    addContribution((SubCircle)attribute.getPlusInside(),true,node);
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public void visitInternalNode(final BSPTree<Sphere2D> node){
}
Program: 57203
Project: 57203
Buggy source:
/** 
 * {@inheritDoc}
 * @exception MathIllegalStateException if the tolerance setting does not allow to builda clean non-ambiguous boundary
 */
@Override protected void computeGeometricalProperties() throws MathIllegalStateException {
  final List<Vertex> boundary=getBoundaryLoops();
  if (boundary.isEmpty()) {
    final BSPTree<Sphere2D> tree=getTree(false);
    if (tree.getCut() == null && (Boolean)tree.getAttribute()) {
      setSize(4 * FastMath.PI);
    }
 else {
      setSize(0);
    }
    setBarycenter(new S2Point(0,0));
  }
 else {
    double sumArea=0;
    Vector3D sumB=Vector3D.ZERO;
    for (    final Vertex startVertex : boundary) {
      int n=0;
      double sum=0;
      Vector3D sumP=Vector3D.ZERO;
      for (Edge edge=startVertex.getOutgoing(); n == 0 || edge.getStart() != startVertex; edge=edge.getEnd().getOutgoing()) {
        final Vector3D middle=edge.getPointAt(0.5 * edge.getLength());
        sumP=new Vector3D(1,sumP,edge.getLength(),middle);
        final Vector3D previousPole=edge.getCircle().getPole();
        final Vector3D nextPole=edge.getEnd().getOutgoing().getCircle().getPole();
        final Vector3D point=edge.getEnd().getLocation().getVector();
        double alpha=FastMath.atan2(Vector3D.dotProduct(nextPole,Vector3D.crossProduct(point,previousPole)),-Vector3D.dotProduct(nextPole,previousPole));
        if (alpha < 0) {
          alpha+=MathUtils.TWO_PI;
        }
        sum+=alpha;
        n++;
      }
      final double area=sum - (n - 2) * FastMath.PI;
      sumArea+=area;
      sumB=new Vector3D(1,sumB,area,sumP);
    }
    if (sumArea < 0) {
      sumArea=4 * FastMath.PI - sumArea;
      sumB=sumB.negate();
    }
    setSize(sumArea);
    final double norm=sumB.getNorm();
    if (norm == 0.0) {
      setBarycenter(S2Point.NaN);
    }
 else {
      setBarycenter(new S2Point(new Vector3D(1.0 / norm,sumB)));
    }
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 * @exception MathIllegalStateException if the tolerance setting does not allow to builda clean non-ambiguous boundary
 */
@Override protected void computeGeometricalProperties() throws MathIllegalStateException {
  final BSPTree<Sphere2D> tree=getTree(true);
  if (tree.getCut() == null) {
    if (tree.getCut() == null && (Boolean)tree.getAttribute()) {
      setSize(4 * FastMath.PI);
      setBarycenter(new S2Point(0,0));
    }
 else {
      setSize(0);
      setBarycenter(S2Point.NaN);
    }
  }
 else {
    final PropertiesComputer pc=new PropertiesComputer(getTolerance());
    tree.visit(pc);
    setSize(pc.getArea());
    setBarycenter(pc.getBarycenter());
  }
}
Program: 57204
Project: 57204
Buggy source:
/** 
 * {@inheritDoc} 
 */
public void visitLeafNode(final BSPTree<Sphere2D> node){
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public void visitLeafNode(final BSPTree<Sphere2D> node){
  if ((Boolean)node.getAttribute()) {
    final SphericalPolygonsSet convex=new SphericalPolygonsSet(node.pruneAroundConvexCell(Boolean.TRUE,Boolean.FALSE,null),tolerance);
    final List<Vertex> boundary=convex.getBoundaryLoops();
    if (boundary.size() != 1) {
      throw new MathInternalError();
    }
    final double area=convexCellArea(boundary.get(0));
    final Vector3D barycenter=convexCellBarycenter(boundary.get(0));
    summedArea+=area;
    summedBarycenter=new Vector3D(1,summedBarycenter,area,barycenter);
  }
}
Program: 57206
Project: 57206
Buggy source:
/** 
 * Create a split part.
 * @param tree BSP tree containing the limit angles of the split part
 * @param ignored if true, some end points have been ignored previously
 * @return split part (may be null)
 */
private ArcsSet createSplitPart(final BSPTree<Sphere1D> tree,final boolean ignored){
  if (ignored) {
    final BSPTree<Sphere1D> first=getFirstLeaf(tree);
    final boolean firstState=(Boolean)first.getAttribute();
    final BSPTree<Sphere1D> last=getLastLeaf(tree);
    final boolean lastState=(Boolean)last.getAttribute();
    if (firstState ^ lastState) {
      first.insertCut(new LimitAngle(new S1Point(0.0),true,getTolerance()));
      first.getPlus().setAttribute(firstState);
      first.getMinus().setAttribute(lastState);
    }
  }
  if (tree.getCut() == null && !(Boolean)tree.getAttribute()) {
    return null;
  }
 else {
    return new ArcsSet(tree,getTolerance());
  }
}

Fixed version (ground truth):
/** 
 * Create a split part.
 * @param tree BSP tree containing the limit angles of the split part
 * @return split part (may be null)
 */
private ArcsSet createSplitPart(final BSPTree<Sphere1D> tree){
  if (tree.getCut() == null && !(Boolean)tree.getAttribute()) {
    return null;
  }
 else {
    return new ArcsSet(tree,getTolerance());
  }
}
Program: 57210
Project: 57210
Buggy source:
@Test public void testSplitOver2Pi(){
  ArcsSet set=new ArcsSet(1.0e-10);
  Arc arc=new Arc(1.5 * FastMath.PI,2.5 * FastMath.PI,1.0e-10);
  ArcsSet.Split split=set.split(arc);
  for (double alpha=0; alpha <= MathUtils.TWO_PI; alpha+=0.01) {
    S1Point p=new S1Point(alpha);
    if (alpha < 0.5 * FastMath.PI || alpha > 1.5 * FastMath.PI) {
      Assert.assertEquals(Location.OUTSIDE,split.getPlus().checkPoint(p));
      Assert.assertEquals(Location.INSIDE,split.getMinus().checkPoint(p));
    }
 else {
      Assert.assertEquals(Location.INSIDE,split.getPlus().checkPoint(p));
      Assert.assertEquals(Location.OUTSIDE,split.getMinus().checkPoint(p));
    }
  }
}

Fixed version (ground truth):
@Test public void testSplitOver2Pi(){
  ArcsSet set=new ArcsSet(1.0e-10);
  Arc arc=new Arc(1.5 * FastMath.PI,2.5 * FastMath.PI,1.0e-10);
  ArcsSet.Split split=set.split(arc);
  for (double alpha=0.0; alpha <= MathUtils.TWO_PI; alpha+=0.01) {
    S1Point p=new S1Point(alpha);
    if (alpha < 0.5 * FastMath.PI || alpha > 1.5 * FastMath.PI) {
      Assert.assertEquals(Location.OUTSIDE,split.getPlus().checkPoint(p));
      Assert.assertEquals(Location.INSIDE,split.getMinus().checkPoint(p));
    }
 else {
      Assert.assertEquals(Location.INSIDE,split.getPlus().checkPoint(p));
      Assert.assertEquals(Location.OUTSIDE,split.getMinus().checkPoint(p));
    }
  }
}
Program: 57213
Project: 57213
Buggy source:
@Test public void testFullSphere(){
  SphericalPolygonsSet full=new SphericalPolygonsSet(1.0e-10);
  UnitSphereRandomVectorGenerator random=new UnitSphereRandomVectorGenerator(3,new Well1024a(0x852fd2a0ed8d2f6dl));
  for (int i=0; i < 1000; ++i) {
    Vector3D v=new Vector3D(random.nextVector());
    Assert.assertEquals(Location.INSIDE,full.checkPoint(new S2Point(v)));
  }
}

Fixed version (ground truth):
@Test public void testFullSphere(){
  SphericalPolygonsSet full=new SphericalPolygonsSet(1.0e-10);
  UnitSphereRandomVectorGenerator random=new UnitSphereRandomVectorGenerator(3,new Well1024a(0x852fd2a0ed8d2f6dl));
  for (int i=0; i < 1000; ++i) {
    Vector3D v=new Vector3D(random.nextVector());
    Assert.assertEquals(Location.INSIDE,full.checkPoint(new S2Point(v)));
  }
  Assert.assertEquals(4 * FastMath.PI,new SphericalPolygonsSet(0.01,new S2Point[0]).getSize(),1.0e-10);
  Assert.assertEquals(0,new SphericalPolygonsSet(0.01,new S2Point[0]).getBoundarySize(),1.0e-10);
}
Program: 57214
Project: 57214
Buggy source:
@Test public void testSouthHemisphere(){
  double tol=0.01;
  double sinTol=FastMath.sin(tol);
  SphericalPolygonsSet south=new SphericalPolygonsSet(Vector3D.MINUS_K,tol);
  UnitSphereRandomVectorGenerator random=new UnitSphereRandomVectorGenerator(3,new Well1024a(0x852fd2a0ed8d2f6dl));
  for (int i=0; i < 1000; ++i) {
    Vector3D v=new Vector3D(random.nextVector());
    if (v.getZ() < -sinTol) {
      Assert.assertEquals(Location.INSIDE,south.checkPoint(new S2Point(v)));
    }
 else     if (v.getZ() > sinTol) {
      Assert.assertEquals(Location.OUTSIDE,south.checkPoint(new S2Point(v)));
    }
 else {
      Assert.assertEquals("String_Node_Str" + v.getX() + "String_Node_Str"+ v.getY()+ "String_Node_Str"+ v.getZ(),Location.BOUNDARY,south.checkPoint(new S2Point(v)));
    }
  }
}

Fixed version (ground truth):
@Test public void testSouthHemisphere(){
  double tol=0.01;
  double sinTol=FastMath.sin(tol);
  SphericalPolygonsSet south=new SphericalPolygonsSet(Vector3D.MINUS_K,tol);
  UnitSphereRandomVectorGenerator random=new UnitSphereRandomVectorGenerator(3,new Well1024a(0x6b9d4a6ad90d7b0bl));
  for (int i=0; i < 1000; ++i) {
    Vector3D v=new Vector3D(random.nextVector());
    if (v.getZ() < -sinTol) {
      Assert.assertEquals(Location.INSIDE,south.checkPoint(new S2Point(v)));
    }
 else     if (v.getZ() > sinTol) {
      Assert.assertEquals(Location.OUTSIDE,south.checkPoint(new S2Point(v)));
    }
 else {
      Assert.assertEquals(Location.BOUNDARY,south.checkPoint(new S2Point(v)));
    }
  }
}
Program: 57215
Project: 57215
Buggy source:
/** 
 * Compute the distance between the instance and another vector according to the L<sub>2</sub> norm. <p>Calling this method is equivalent to calling: <code>q.subtract(p).getNorm()</code> except that no intermediate vector is built</p>
 * @param v second vector
 * @return the distance between the instance and p according to the L<sub>2</sub> norm
 */
double distance(Vector<S> v);

Fixed version (ground truth):
/** 
 * Compute the distance between the instance and another vector according to the L<sub>2</sub> norm. <p>Calling this method is equivalent to calling: <code>q.subtract(p).getNorm()</code> except that no intermediate vector is built</p>
 * @param v second vector
 * @return the distance between the instance and p according to the L<sub>2</sub> norm
 * @deprecated as of 3.3 replaced with {@link Point#distance(Point)}
 */
@Deprecated double distance(Vector<S> v);
Program: 57216
Project: 57216
Buggy source:
/** 
 * Build an intervals set from a Boundary REPresentation (B-rep). <p>The boundary is provided as a collection of   {@link SubHyperplane sub-hyperplanes}. Each sub-hyperplane has the interior part of the region on its minus side and the exterior on its plus side.</p> <p>The boundary elements can be in any order, and can form several non-connected sets (like for example polygons with holes or a set of disjoints polyhedrons considered as a whole). In fact, the elements do not even need to be connected together (their topological connections are not used here). However, if the boundary does not really separate an inside open from an outside open (open having here its topological meaning), then subsequent calls to the   {@link org.apache.commons.math3.geometry.partitioning.Region#checkPoint(org.apache.commons.math3.geometry.Vector) checkPoint} method will not be meaningful anymore.</p><p>If the boundary is empty, the region will represent the whole space.</p>
 * @param boundary collection of boundary elements
 */
public IntervalsSet(final Collection<SubHyperplane<Euclidean1D>> boundary){
  super(boundary);
}

Fixed version (ground truth):
/** 
 * Build an intervals set from a Boundary REPresentation (B-rep). <p>The boundary is provided as a collection of   {@link SubHyperplane sub-hyperplanes}. Each sub-hyperplane has the interior part of the region on its minus side and the exterior on its plus side.</p> <p>The boundary elements can be in any order, and can form several non-connected sets (like for example polygons with holes or a set of disjoints polyhedrons considered as a whole). In fact, the elements do not even need to be connected together (their topological connections are not used here). However, if the boundary does not really separate an inside open from an outside open (open having here its topological meaning), then subsequent calls to the   {@link org.apache.commons.math3.geometry.partitioning.Region#checkPoint(org.apache.commons.math3.geometry.Point) checkPoint} method will not be meaningful anymore.</p><p>If the boundary is empty, the region will represent the whole space.</p>
 * @param boundary collection of boundary elements
 */
public IntervalsSet(final Collection<SubHyperplane<Euclidean1D>> boundary){
  super(boundary);
}
Program: 57217
Project: 57217
Buggy source:
/** 
 * {@inheritDoc} 
 */
@Override protected void computeGeometricalProperties(){
  if (getTree(false).getCut() == null) {
    setBarycenter(Vector1D.NaN);
    setSize(((Boolean)getTree(false).getAttribute()) ? Double.POSITIVE_INFINITY : 0);
  }
 else {
    double size=0.0;
    double sum=0.0;
    for (    final Interval interval : asList()) {
      size+=interval.getSize();
      sum+=interval.getSize() * interval.getBarycenter();
    }
    setSize(size);
    if (Double.isInfinite(size)) {
      setBarycenter(Vector1D.NaN);
    }
 else     if (size >= Precision.SAFE_MIN) {
      setBarycenter(new Vector1D(sum / size));
    }
 else {
      setBarycenter(((OrientedPoint)getTree(false).getCut().getHyperplane()).getLocation());
    }
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
@Override protected void computeGeometricalProperties(){
  if (getTree(false).getCut() == null) {
    setBarycenter((Point<Euclidean1D>)Vector1D.NaN);
    setSize(((Boolean)getTree(false).getAttribute()) ? Double.POSITIVE_INFINITY : 0);
  }
 else {
    double size=0.0;
    double sum=0.0;
    for (    final Interval interval : asList()) {
      size+=interval.getSize();
      sum+=interval.getSize() * interval.getBarycenter();
    }
    setSize(size);
    if (Double.isInfinite(size)) {
      setBarycenter((Point<Euclidean1D>)Vector1D.NaN);
    }
 else     if (size >= Precision.SAFE_MIN) {
      setBarycenter((Point<Euclidean1D>)new Vector1D(sum / size));
    }
 else {
      setBarycenter((Point<Euclidean1D>)((OrientedPoint)getTree(false).getCut().getHyperplane()).getLocation());
    }
  }
}
Program: 57218
Project: 57218
Buggy source:
/** 
 * Update an intervals list.
 * @param node current node
 * @param list list to update
 * @param lower lower bound of the current convex cell
 * @param upper upper bound of the current convex cell
 */
private void recurseList(final BSPTree<Euclidean1D> node,final List<Interval> list,final double lower,final double upper){
  if (node.getCut() == null) {
    if ((Boolean)node.getAttribute()) {
      list.add(new Interval(lower,upper));
    }
  }
 else {
    final OrientedPoint op=(OrientedPoint)node.getCut().getHyperplane();
    final Vector1D loc=op.getLocation();
    double x=loc.getX();
    final BSPTree<Euclidean1D> low=op.isDirect() ? node.getMinus() : node.getPlus();
    final BSPTree<Euclidean1D> high=op.isDirect() ? node.getPlus() : node.getMinus();
    recurseList(low,list,lower,x);
    if ((checkPoint(low,loc) == Location.INSIDE) && (checkPoint(high,loc) == Location.INSIDE)) {
      x=list.remove(list.size() - 1).getInf();
    }
    recurseList(high,list,x,upper);
  }
}

Fixed version (ground truth):
/** 
 * Update an intervals list.
 * @param node current node
 * @param list list to update
 * @param lower lower bound of the current convex cell
 * @param upper upper bound of the current convex cell
 */
private void recurseList(final BSPTree<Euclidean1D> node,final List<Interval> list,final double lower,final double upper){
  if (node.getCut() == null) {
    if ((Boolean)node.getAttribute()) {
      list.add(new Interval(lower,upper));
    }
  }
 else {
    final OrientedPoint op=(OrientedPoint)node.getCut().getHyperplane();
    final Vector1D loc=op.getLocation();
    double x=loc.getX();
    final BSPTree<Euclidean1D> low=op.isDirect() ? node.getMinus() : node.getPlus();
    final BSPTree<Euclidean1D> high=op.isDirect() ? node.getPlus() : node.getMinus();
    recurseList(low,list,lower,x);
    if ((checkPoint(low,(Point<Euclidean1D>)loc) == Location.INSIDE) && (checkPoint(high,(Point<Euclidean1D>)loc) == Location.INSIDE)) {
      x=list.remove(list.size() - 1).getInf();
    }
    recurseList(high,list,x,upper);
  }
}
Program: 57220
Project: 57220
Buggy source:
/** 
 * {@inheritDoc} 
 */
public SubHyperplane<Euclidean2D> apply(final SubHyperplane<Euclidean2D> sub,final Hyperplane<Euclidean3D> original,final Hyperplane<Euclidean3D> transformed){
  if (original != cachedOriginal) {
    final Plane oPlane=(Plane)original;
    final Plane tPlane=(Plane)transformed;
    final Vector2D shift=tPlane.toSubSpace(apply(oPlane.getOrigin()));
    final AffineTransform at=AffineTransform.getTranslateInstance(shift.getX(),shift.getY());
    cachedOriginal=(Plane)original;
    cachedTransform=org.apache.commons.math3.geometry.euclidean.twod.Line.getTransform(at);
  }
  return ((SubLine)sub).applyTransform(cachedTransform);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public SubHyperplane<Euclidean2D> apply(final SubHyperplane<Euclidean2D> sub,final Hyperplane<Euclidean3D> original,final Hyperplane<Euclidean3D> transformed){
  if (original != cachedOriginal) {
    final Plane oPlane=(Plane)original;
    final Plane tPlane=(Plane)transformed;
    final Vector2D shift=tPlane.toSubSpace((Point<Euclidean3D>)apply(oPlane.getOrigin()));
    final AffineTransform at=AffineTransform.getTranslateInstance(shift.getX(),shift.getY());
    cachedOriginal=(Plane)original;
    cachedTransform=org.apache.commons.math3.geometry.euclidean.twod.Line.getTransform(at);
  }
  return ((SubLine)sub).applyTransform(cachedTransform);
}
Program: 57221
Project: 57221
Buggy source:
/** 
 * Get the first sub-hyperplane crossed by a semi-infinite line.
 * @param node current node
 * @param point start point of the part of the line considered
 * @param line line to consider (contains point)
 * @return the first sub-hyperplaned crossed by the line after thegiven point, or null if the line does not intersect any sub-hyperplaned
 */
private SubHyperplane<Euclidean3D> recurseFirstIntersection(final BSPTree<Euclidean3D> node,final Vector3D point,final Line line){
  final SubHyperplane<Euclidean3D> cut=node.getCut();
  if (cut == null) {
    return null;
  }
  final BSPTree<Euclidean3D> minus=node.getMinus();
  final BSPTree<Euclidean3D> plus=node.getPlus();
  final Plane plane=(Plane)cut.getHyperplane();
  final double offset=plane.getOffset(point);
  final boolean in=FastMath.abs(offset) < 1.0e-10;
  final BSPTree<Euclidean3D> near;
  final BSPTree<Euclidean3D> far;
  if (offset < 0) {
    near=minus;
    far=plus;
  }
 else {
    near=plus;
    far=minus;
  }
  if (in) {
    final SubHyperplane<Euclidean3D> facet=boundaryFacet(point,node);
    if (facet != null) {
      return facet;
    }
  }
  final SubHyperplane<Euclidean3D> crossed=recurseFirstIntersection(near,point,line);
  if (crossed != null) {
    return crossed;
  }
  if (!in) {
    final Vector3D hit3D=plane.intersection(line);
    if (hit3D != null) {
      final SubHyperplane<Euclidean3D> facet=boundaryFacet(hit3D,node);
      if (facet != null) {
        return facet;
      }
    }
  }
  return recurseFirstIntersection(far,point,line);
}

Fixed version (ground truth):
/** 
 * Get the first sub-hyperplane crossed by a semi-infinite line.
 * @param node current node
 * @param point start point of the part of the line considered
 * @param line line to consider (contains point)
 * @return the first sub-hyperplaned crossed by the line after thegiven point, or null if the line does not intersect any sub-hyperplaned
 */
private SubHyperplane<Euclidean3D> recurseFirstIntersection(final BSPTree<Euclidean3D> node,final Vector3D point,final Line line){
  final SubHyperplane<Euclidean3D> cut=node.getCut();
  if (cut == null) {
    return null;
  }
  final BSPTree<Euclidean3D> minus=node.getMinus();
  final BSPTree<Euclidean3D> plus=node.getPlus();
  final Plane plane=(Plane)cut.getHyperplane();
  final double offset=plane.getOffset((Point<Euclidean3D>)point);
  final boolean in=FastMath.abs(offset) < 1.0e-10;
  final BSPTree<Euclidean3D> near;
  final BSPTree<Euclidean3D> far;
  if (offset < 0) {
    near=minus;
    far=plus;
  }
 else {
    near=plus;
    far=minus;
  }
  if (in) {
    final SubHyperplane<Euclidean3D> facet=boundaryFacet(point,node);
    if (facet != null) {
      return facet;
    }
  }
  final SubHyperplane<Euclidean3D> crossed=recurseFirstIntersection(near,point,line);
  if (crossed != null) {
    return crossed;
  }
  if (!in) {
    final Vector3D hit3D=plane.intersection(line);
    if (hit3D != null) {
      final SubHyperplane<Euclidean3D> facet=boundaryFacet(hit3D,node);
      if (facet != null) {
        return facet;
      }
    }
  }
  return recurseFirstIntersection(far,point,line);
}
Program: 57222
Project: 57222
Buggy source:
/** 
 * Simple constructor. 
 */
public FacetsContributionVisitor(){
  setSize(0);
  setBarycenter(new Vector3D(0,0,0));
}

Fixed version (ground truth):
/** 
 * Simple constructor. 
 */
public FacetsContributionVisitor(){
  setSize(0);
  setBarycenter((Point<Euclidean3D>)new Vector3D(0,0,0));
}