Collect all ordering results from a Result

@param r Result
@return List of ordering results
358574
public static List<OrderingResult> getOrderingResults(Result r) {
    if(r instanceof OrderingResult) {
      List<OrderingResult> ors = new ArrayList<>(1);
      ors.add((OrderingResult) r);
      return ors;
    }
    if(r instanceof HierarchicalResult) {
      return filterResults(((HierarchicalResult) r).getHierarchy(), r, OrderingResult.class);
    }
    return Collections.emptyList();
  }
404314
public java.util.List<ResultAttribute> getResultAttributes() {
        if (resultAttributes == null) {
            resultAttributes = new com.amazonaws.internal.SdkInternalList<ResultAttribute>();
        }
        return resultAttributes;
    }
555142
def _results(r):
    """
    x, funcalls, iterations, flag = r
    return results(x, funcalls, iterations, flag == 0)
876635
public List<T> filter(List<T> results) {
        if (filters.isEmpty() || results == null) {
            return results;
        }
        
        List<T> include = new ArrayList<>();
        
        for (T result : results) {
            if (include(result)) {
                include.add(result);
            }
        }
        
        return results.size() == include.size() ? results : include;
    }
448290
@SuppressWarnings("unchecked")
  public void output(Database db, Result r, StreamFactory streamOpener, Pattern filter) throws IOException {
    List<Relation<?>> ra = new LinkedList<>();
    List<OrderingResult> ro = new LinkedList<>();
    List<Clustering<?>> rc = new LinkedList<>();
    List<IterableResult<?>> ri = new LinkedList<>();
    List<SettingsResult> rs = new LinkedList<>();
    List<Result> otherres = new LinkedList<>();

    // Split result objects in different known types:
    {
      List<Result> results = ResultUtil.filterResults(db.getHierarchy(), r, Result.class);
      for(Result res : results) {
        if(filter != null) {
          final String nam = res.getShortName();
          if(nam == null || !filter.matcher(nam).find()) {
            continue;
          }
        }
        if(res instanceof Database) {
          continue;
        }
        if(res instanceof Relation) {
          ra.add((Relation<?>) res);
          continue;
        }
        if(res instanceof OrderingResult) {
          ro.add((OrderingResult) res);
          continue;
        }
        if(res instanceof Clustering) {
          rc.add((Clustering<?>) res);
          continue;
        }
        if(res instanceof IterableResult) {
          ri.add((IterableResult<?>) res);
          continue;
        }
        if(res instanceof SettingsResult) {
          rs.add((SettingsResult) res);
          continue;
        }
        otherres.add(res);
      }
    }

    writeSettingsResult(streamOpener, rs);

    for(IterableResult<?> rii : ri) {
      writeIterableResult(streamOpener, rii);
    }
    for(Clustering<?> c : rc) {
      NamingScheme naming = new SimpleEnumeratingScheme(c);
      for(Cluster<?> clus : c.getAllClusters()) {
        writeClusterResult(db, streamOpener, (Clustering<Model>) c, (Cluster<Model>) clus, ra, naming);
      }
    }
    for(OrderingResult ror : ro) {
      writeOrderingResult(db, streamOpener, ror, ra);
    }
    for(Result otherr : otherres) {
      writeOtherResult(streamOpener, otherr);
    }
  }
889900
public static <S extends Storable> OrderingList<S> get(OrderedProperty<S>... orderings) {
        OrderingList<S> list = emptyList();
        if (orderings != null && orderings.length > 0) {
            for (OrderedProperty<S> property : orderings) {
                list = list.concat(property);
            }
        }
        return list;
    }
1189785
@Override
	public List<CommerceOrderNote> findAll() {
		return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
	}
817275
public List<Rc> sortByTitleAndFilterDoubles(List<Rc> rcList) {
    List<Rc> result = new ArrayList<Rc>();
    List<Rc> sorted = new ArrayList<Rc>();
    sorted.addAll(rcList);
    Collections.sort(sorted, new Comparator<Rc>() {
      @Override
      public int compare(Rc lRc, Rc rRc) {
        int result = lRc.getTitle().compareTo(rRc.getTitle());
        if (result == 0) {
          result = rRc.getTimestamp().compare(lRc.getTimestamp());
        }
        return result;
      }
    });
    Rc previous = null;
    for (Rc rc : sorted) {
      if (previous == null || (!rc.getTitle().equals(previous.getTitle()))) {
        result.add(rc);
      }
      previous = rc;
    }
    Collections.sort(result, new Comparator<Rc>() {
      @Override
      public int compare(Rc lRc, Rc rRc) {
        int result = rRc.getTimestamp().compare(lRc.getTimestamp());
        return result;
      }
    });
    return result;
  }
947085
private List<OrderSpecifier> getOrderByList(HttpServletRequest request) throws Exception {
		String[] orderByStrings = request.getParameterValues("orderBy");
		if( null == orderByStrings ) {
			return null;
		}
		if( 0 == orderByStrings.length ) {
			return null;
		}
		
		List<OrderSpecifier> result = new Vector<OrderSpecifier>();
		
		for(String orderByString : orderByStrings) {
			OrderSpecifier orderSpecifier = parseOrderSpecifier(orderByString);
			result.add(orderSpecifier);
		}

		return result;
	}
1124317
public Gather<T> order(Ordering<T> ordering) {
		Collection<T> sorted = ordering.sortedCopy(list());
		elements = Optional.fromNullable(sorted);
		return this;
	}
926430
@Override
    public void readFragmentFrom(MwsReader r) {
        listOrderItemsByNextTokenResult = r.read("ListOrderItemsByNextTokenResult", ListOrderItemsByNextTokenResult.class);
        responseMetadata = r.read("ResponseMetadata", ResponseMetadata.class);
    }
88519
@Transactional(readOnly = true)
	public Collection<Response> findAll() {
		return em.createQuery("FROM Response", Response.class).getResultList();
	}
415357
public List<SqlResultSetMapping<OrmDescriptor>> getAllSqlResultSetMapping()
   {
      List<SqlResultSetMapping<OrmDescriptor>> list = new ArrayList<SqlResultSetMapping<OrmDescriptor>>();
      List<Node> nodeList = model.get("sql-result-set-mapping");
      for(Node node: nodeList)
      {
         SqlResultSetMapping<OrmDescriptor>  type = new SqlResultSetMappingImpl<OrmDescriptor>(this, "sql-result-set-mapping", model, node);
         list.add(type);
      }
      return list;
   }
1016184
public List<T> getAll() {
		List<T> result = new ArrayList<T>();
		if (nodes != null)
			for(Node element : nodes) 
				result.add(getCachedOrNewRepresentation(element));
		return result;
	}
	
	public int size() {
		return nodes.size();
	}
	
	public T get(int index) {
		return getCachedOrNewRepresentation(nodes.get(index));
	}
		
	public Iterator<T> iterator() {
		return getAll().iterator();
	}
}
107432
private void formatResultSet(ResultSet r) {

        if (r == null) {
            String[] g = new String[1];

            g[0] = "Result";

            gResult.setHead(g);

            g[0] = "(empty)";

            gResult.addRow(g);

            return;
        }

        try {
            ResultSetMetaData m         = r.getMetaData();
            int               col       = m.getColumnCount();
            Object[]          h         = new Object[col];
            boolean[]         isVarChar = new boolean[col];

            for (int i = 1; i <= col; i++) {
                h[i - 1] = m.getColumnLabel(i);
                isVarChar[i - 1] = (m.getColumnType(i)
                                    == java.sql.Types.VARCHAR);
            }

            gResult.setHead(h);

            while (r.next()) {
                for (int i = 1; i <= col; i++) {
                    try {
                        h[i - 1] = r.getObject(i);

                        if (r.wasNull()) {
                            h[i - 1] = (isVarChar[i - 1] ? NULL_STR
                                                         : null);
                        }
                    } catch (SQLException e) {}
                }

                gResult.addRow(h);
            }

            r.close();
        } catch (SQLException e) {

            //  Added: (weconsultants@users)
            CommonSwing.errorMessage(e);
        }
    }
570369
public static <T> List<String> getUniqeDocIdList(List<T> results, Ordering<T> ordering, Function<T, String> toIdString) {
    Collections.sort(results, ordering);
    Set<String> list = Sets.newLinkedHashSet();
    for (T result : results) {
      list.add(toIdString.apply(result));
    }
    return Lists.newArrayList(list);
  }
259274
public static List<Clustering<? extends Model>> getClusteringResults(Result r) {
    if(r instanceof Clustering<?>) {
      List<Clustering<?>> crs = new ArrayList<>(1);
      crs.add((Clustering<?>) r);
      return crs;
    }
    if(r instanceof HierarchicalResult) {
      return ResultUtil.filterResults(((HierarchicalResult) r).getHierarchy(), r, Clustering.class);
    }
    return Collections.emptyList();
  }