merge method

void merge(
  1. TopologyLocation gl
)

merge updates only the NULL attributes of this object with the attributes of another.

Implementation

void merge(TopologyLocation gl) {
  // if the src is an Area label & and the dest is not, increase the dest to be an Area
  if (gl.location.length > location.length) {
    List<int> newLoc = List.filled(3, 0);
    newLoc[Position.ON] = location[Position.ON];
    newLoc[Position.LEFT] = Location.NONE;
    newLoc[Position.RIGHT] = Location.NONE;
    location = newLoc;
  }
  for (int i = 0; i < location.length; i++) {
    if (location[i] == Location.NONE && i < gl.location.length)
      location[i] = gl.location[i];
  }
}