code: private boolean assignSubstituents(int[] cycle,
                                         int[] above,
                                         int[] below,
                                         WoundProjection projection,
                                         Point2d horizontalXy) {
  
          boolean haworth = projection.projection == Projection.Haworth;
  
          int found = 0;
          
          for (int i = 1; i <= cycle.length; i++) {
  
              int j = i % cycle.length;
  
              int prev = cycle[i - 1];
              int curr = cycle[j];
              int next = cycle[(i + 1) % cycle.length];
  
              // get the substituents not in the ring (i.e. excl. prev and next)
              int[] ws = filter(graph[curr], prev, next);
  
              if (ws.length > 2 || ws.length < 1)
                  continue;
  
              Point2d centerXy = container.getAtom(curr).getPoint2d();
  
              // determine the direction of each substituent 
              for (final int w : ws) {
                  Point2d otherXy = container.getAtom(w).getPoint2d();
                  Direction direction = direction(centerXy, otherXy, horizontalXy, haworth);
  
                  switch (direction) {
                      case Up:
                          if (above[j] != curr) return false;
                          above[j] = w;
                          break;
                      case Down:
                          if (below[j] != curr) return false;
                          below[j] = w;
                          break;
                      case Other:
                          return false;
                  }
              }
  
              if (above[j] != curr || below[j] != curr)
                found++;
          }
          
          // must have at least 2 that look projected for Haworth
          return found > 1 || projection.projection != Projection.Haworth;
      }
docs: Given a projected cycle, assign the exocyclic substituents to being above
  of below the projection. For Haworth projections, the substituents must
  be directly up or down (within some threshold).
  
  @param cycle        vertices that form a cycle
  @param above        vertices that will be above the cycle (filled by
  method)
  @param below        vertices that will be below the cycle (filled by
  method)
  @param projection   the type of projection
  @param horizontalXy offset from the horizontal axis
  @return assignment okay (true), not okay (false)