setEdgeDepths method

void setEdgeDepths(
  1. int position,
  2. int depth
)

Set both edge depths. One depth for a given side is provided. The other is computed depending on the Location transition and the depthDelta of the edge.

Implementation

void setEdgeDepths(int position, int depth) {
  // get the depth transition delta from R to L for this directed Edge
  int depthDelta = getEdge().getDepthDelta();
  if (!_isForward) depthDelta = -depthDelta;

  // if moving from L to R instead of R to L must change sign of delta
  int directionFactor = 1;
  if (position == Position.LEFT) directionFactor = -1;

  int oppositePos = Position.opposite(position);
  int delta = depthDelta * directionFactor;
  //TESTINGint delta = depthDelta * DirectedEdge.depthFactor(loc, oppositeLoc);
  int oppositeDepth = depth + delta;
  setDepth(position, depth);
  setDepth(oppositePos, oppositeDepth);
}