docs: private int xiSteepClusterExtract(final int n, List<Integer> orderedFile, int[] designations)
      {
          ///Now obtain clustering
          ///Extract CLustering
          int clustersFound = 0;
          Set<Integer> sdaSet = new IntSet();
          int orderIndex = 0;
          double mib = 0;
          double[] mibVals = new double[n];
  
          List<OPTICSCluster> clusters = new ArrayList<OPTICSCluster>();
          List<Integer> allSteepUp = new IntList();
          List<Integer> allSDA = new IntList();
          /*
           * Ugly else if to increment orderIndex counter and avoid geting stuck 
           * in infinite loops. 
           * Can I write that a better way? 
           */
          while(orderIndex < orderedFile.size()-1)
          {
              
              int curIndex = orderedFile.get(orderIndex);
              mib = Math.max(mib, reach_d[curIndex]);
              
              if(orderIndex +1 < orderedFile.size())
              {
                  int nextIndex = orderedFile.get(orderIndex+1);
                  if(!downPoint(curIndex, nextIndex))//IF(start of a steep down area D at index)
                  {
                      filterSDASet(sdaSet, mib, mibVals, orderedFile);
                      
                      sdaSet.add(orderIndex);
                      allSDA.add(orderIndex);
                      
                      while(orderIndex+1 < orderedFile.size())
                      {
                          orderIndex++;
                          curIndex = nextIndex;
                          if(orderIndex+1 >= orderedFile.size())
                              break;
                          nextIndex = orderedFile.get(orderIndex+1);
                          if(downPoint(curIndex, nextIndex))
                              break;
                      }
  
                      mib = reach_d[curIndex];
                  }
                  else if(!upPoint(curIndex, nextIndex))//ELSE IF(start of steep up area U at index)
                  {
                      
                      filterSDASet(sdaSet, mib, mibVals, orderedFile);
                      if(!sdaSet.isEmpty())
                          allSteepUp.add(orderIndex);
                      
                      while(orderIndex+1 < orderedFile.size())
                      {
                          orderIndex++;
                          curIndex = nextIndex;
                          if(orderIndex+1 >= orderedFile.size())
                              break;
                          nextIndex = orderedFile.get(orderIndex+1);
                          if(upPoint(curIndex, nextIndex))
                              break;
                      }
                      
                      mib = reach_d[curIndex];
  
                      for(Iterator<Integer> iter = sdaSet.iterator(); iter.hasNext(); )
                      {
                          int sdaOrdered = iter.next();
                          int sdaIndx = orderedFile.get(sdaOrdered);
                          if(!(orderIndex-sdaOrdered >= minPts))//Fail 3a
                              continue;
                          else if(mib * one_min_xi < mibVals[sdaIndx])
                          {
                              continue;
                          }
                          if(sdaOrdered > orderIndex)
                              continue;
                          OPTICSCluster newClust = new OPTICSCluster(sdaOrdered, orderIndex+1);
                          OPTICSCluster tmp;
                          for(Iterator<OPTICSCluster> clustIter = clusters.iterator(); clustIter.hasNext();)
                          {
                              if(newClust.contains((tmp = clustIter.next())))
                              {
                                  clustIter.remove();
                                  newClust.subClusters.add(tmp);
                              }
                          }
                          clusters.add(newClust);
                          
                      }
                      
                  }
                  else
                      orderIndex++;
                  
                  
              }
              else 
                  orderIndex++;
              
          }
          for(OPTICSCluster oc : clusters)
          {
              for(int i : orderedFile.subList(oc.start, oc.end))
                  if(designations[i] < 0)
                      designations[i] = clustersFound;
              clustersFound++;
          }
          return clustersFound;
      }