Order the tests in <code>target</code> using this ordering.

@throws InvalidOrderingException if ordering does something invalid (like remove or add
children)
353317
public void apply(Object target) throws InvalidOrderingException {
        /*
         * Note that some subclasses of Ordering override apply(). The Sorter
         * subclass of Ordering overrides apply() to apply the sort (this is
         * done because sorting is more efficient than ordering).
         */
        if (target instanceof Orderable) {
            Orderable orderable = (Orderable) target;
            orderable.order(new Orderer(this));
        }
    }
225252
public void setSortOrder(final java.lang.String sortOrder) {
        // when updating, make sure we store off the original so it may be
        // restored
        final String orig = (String) getStateHelper().get(PropertyKeys.origSortOrder);
        if (orig == null) {
            // do not call getSortOrder as it defaults to ascending, we want
            // null
            // if this is the first call and there is no previous value.
            getStateHelper().put(PropertyKeys.origSortOrder, getStateHelper().eval(PropertyKeys.sortOrder));
        }
        getStateHelper().put(PropertyKeys.sortOrder, sortOrder);
    }
544348
@Override
    public boolean isOrderDeterministic() {
        if ( ! super.isOrderDeterministic()) {
            return false;
        }
        IndexScanPlanNode index_scan = getInlineIndexScan();
        if ( ! index_scan.isOrderDeterministic()) {
            m_nondeterminismDetail = index_scan.m_nondeterminismDetail;
            return false;
        }
        return true;
    }
1078617
public static void sort(final List<Artifact> targets) {
        int n = targets.size();
        while(n != 0){
            int newn = 0;

            for(int i = 1 ; i <= n-1 ; i++){
                if (targets.get(i-1).toString().compareTo(targets.get(i).toString()) > 0){
                    Collections.swap(targets, i - 1, i);
                    newn = i;
                }
            }

            n = newn;
        }
    }
1143993
protected void setSort(final int index, final boolean ascending) {
		TableModel model = getOrCreateComponentModel();
		model.sortColIndex = index;
		model.sortAscending = ascending;
	}
84086
def sort_targets(targets):
  

  roots, inverted_deps = invert_dependencies(targets)
  ordered = []
  visited = set()

  def topological_sort(target):
    if target not in visited:
      visited.add(target)
      if target in inverted_deps:
        for dep in inverted_deps[target]:
          topological_sort(dep)
      ordered.append(target)

  for root in roots:
    topological_sort(root)

  return ordered
993962
private function orderInstallersByDependencies()
    {
        $sequenceForClasses = [];

        // If installers were already ordered by number then we need
        // to remove classes which are not instances of OrderedInstallerInterface
        // in case installers implementing DependentInstallerInterface exist.
        // This is because, in that case, the method orderInstallersByDependencies
        // will handle all installers which are not instances of
        // OrderedInstallerInterface
        if ($this->orderInstallersByNumber) {
            $count = count($this->orderedInstallers);

            for ($i = 0; $i < $count; ++$i) {
                if (!($this->orderedInstallers[$i] instanceof OrderedInstallerInterface)) {
                    unset($this->orderedInstallers[$i]);
                }
            }
        }

        // First we determine which classes has dependencies and which don't
        foreach ($this->installers as $installer) {
            $installerClass = get_class($installer);

            if ($installer instanceof OrderedInstallerInterface) {
                continue;
            } elseif ($installer instanceof DependentInstallerInterface) {
                $dependenciesClasses = $installer->getDependencies();

                $this->validateDependencies($dependenciesClasses);

                if (!is_array($dependenciesClasses) || empty($dependenciesClasses)) {
                    throw new \InvalidArgumentException(sprintf(
                        'Method "%s" in class "%s" must return an array of classes which are '.
                            'dependencies for the installer, and it must be NOT empty.',
                        'getDependencies',
                        $installerClass
                    ));
                }

                if (in_array($installerClass, $dependenciesClasses)) {
                    throw new \InvalidArgumentException(sprintf(
                        'Class "%s" can\'t have itself as a dependency',
                        $installerClass
                    ));
                }

                // We mark this class as unsequenced
                $sequenceForClasses[$installerClass] = -1;
            } else {
                // This class has no dependencies, so we assign 0
                $sequenceForClasses[$installerClass] = 0;
            }
        }

        // Now we order installers by sequence
        $sequence = 1;
        $lastCount = -1;

        while (($count = count($unsequencedClasses = $this->getUnsequencedClasses($sequenceForClasses))) > 0
                && $count !== $lastCount) {
            foreach ($unsequencedClasses as $key => $class) {
                /** @var DependentInstallerInterface $installer */
                $installer = $this->installers[$class];
                $dependencies = $installer->getDependencies();
                $unsequencedDependencies = $this->getUnsequencedClasses($sequenceForClasses, $dependencies);

                if (count($unsequencedDependencies) === 0) {
                    $sequenceForClasses[$class] = $sequence++;
                }
            }

            $lastCount = $count;
        }

        $orderedInstallers = [];

        // If there are installers unsequenced left and they couldn't be sequenced,
        // it means we have a circular reference
        if ($count > 0) {
            $msg = 'Classes "%s" have produced a circular reference exception. ';
            $msg .= 'An example of this problem would be the following: Class C has class B as its dependency. ';
            $msg .= 'Then, class B has class A has its dependency. Finally, class A has class C as its dependency. ';
            $msg .= 'This case would produce a circular reference exception.';

            throw new \RuntimeException(sprintf($msg, implode(',', $unsequencedClasses)));
        } else {
            // We order the classes by sequence
            asort($sequenceForClasses);

            foreach ($sequenceForClasses as $class => $sequence) {
                // If installers were ordered
                $orderedInstallers[] = $this->installers[$class];
            }
        }

        $this->orderedInstallers = array_merge($this->orderedInstallers, $orderedInstallers);
    }
691304
public OrderingType<WebFragmentType<T>> getOrCreateOrdering()
   {
      List<Node> nodeList = childNode.get("ordering");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new OrderingTypeImpl<WebFragmentType<T>>(this, "ordering", childNode, nodeList.get(0));
      }
      return createOrdering();
   }
980671
@NonNull
    @Override
    public OrderBy orderBy(@NonNull Ordering... orderings) {
        if (orderings == null) {
            throw new IllegalArgumentException("orderings is null.");
        }
        return new OrderBy(this, Arrays.asList(orderings));
    }
379988
public void placeOrderAndWaitUntilActive(final BitfinexNewOrder order) throws BitfinexClientException, InterruptedException {

		final BitfinexApiKeyPermissions capabilities = client.getApiKeyPermissions();

		if(! capabilities.isOrderWritePermission()) {
			throw new BitfinexClientException("Unable to wait for order " + order + " connection has not enough capabilities: " + capabilities);
		}

		order.setApiKey(client.getConfiguration().getApiKey());

		final Callable<Boolean> orderCallable = () -> placeOrderOrderOnAPI(order);

		// Bitfinex does not implement a happens-before relationship. Sometimes
		// canceling a stop-loss order and placing a new stop-loss order results
		// in an 'ERROR, reason is Invalid order: not enough exchange balance'
		// error for some seconds. The retryer tries to place the order up to
		// three times
		final Retryer<Boolean> retryer = new Retryer<>(ORDER_RETRIES, RETRY_DELAY_IN_MS,
				TimeUnit.MILLISECONDS, orderCallable);
		retryer.execute();

		if(retryer.getNeededExecutions() > 1) {
			logger.info("Nedded {} executions for placing the order", retryer.getNeededExecutions());
		}

		if(! retryer.isSuccessfully()) {
			final Exception lastException = retryer.getLastException();

			if(lastException == null) {
				throw new BitfinexClientException("Unable to execute order");
			} else {
				throw new BitfinexClientException(lastException);
			}
		}
	}
908374
static void applyOrdering(
            List<NodeInfo> order,
            Element compViewParent,
            Element positionSet,
            NodeInfoTracker tracker) {

        // first pull out all visible channel or visible folder children and
        // put their id's in a list of available children and record their
        // relative order in the CVP.

        final Map<String, NodeInfo> available = new LinkedHashMap<String, NodeInfo>();

        Element child = (Element) compViewParent.getFirstChild();
        Element next = null;
        int indexInCVP = 0;

        while (child != null) {
            next = (Element) child.getNextSibling();

            if (child.getAttribute("hidden").equals("false")
                    && (!child.getAttribute("chanID").equals("")
                            || child.getAttribute("type").equals("regular"))) {
                final NodeInfo nodeInfo = new NodeInfo(child, indexInCVP++);

                tracker.track(order, compViewParent, positionSet);

                final NodeInfo prevNode = available.put(nodeInfo.getId(), nodeInfo);
                if (prevNode != null) {
                    throw new IllegalStateException(
                            "Infinite loop detected in layout. Triggered by "
                                    + nodeInfo.getId()
                                    + " with already visited node ids: "
                                    + available.keySet());
                }
            }
            child = next;
        }

        // now fill the order list using id's from the position set if nodes
        // having those ids exist in the composite view. Otherwise discard
        // that position directive. As they are added to the list remove them
        // from the available nodes in the parent.

        Document CV = compViewParent.getOwnerDocument();
        Element directive = (Element) positionSet.getFirstChild();

        while (directive != null) {
            next = (Element) directive.getNextSibling();

            // id of child to move is in the name attrib on the position nodes
            String id = directive.getAttribute("name");
            child = CV.getElementById(id);

            if (child != null) {
                // look for the NodeInfo for this node in the available
                // nodes and if found use that one. Otherwise use a new that
                // does not include an index in the CVP parent. In either case
                // indicate the position directive responsible for placing this
                // NodeInfo object in the list.

                final String childId = child.getAttribute(Constants.ATT_ID);
                NodeInfo ni = available.remove(childId);
                if (ni == null) {
                    ni = new NodeInfo(child);
                    tracker.track(order, compViewParent, positionSet);
                }

                ni.setPositionDirective(directive);
                order.add(ni);
            }
            directive = next;
        }

        // now append any remaining ids from the available list maintaining
        // the order that they have there.

        order.addAll(available.values());
    }
798396
public void addOrder(String columnName, boolean ascending) {
    if (columnName == null) {
      return;
    }
    for (int i = 0; i < columns.size(); i++) {
      if (!columnName.equals(columns.get(i).getData())) {
        continue;
      }
      order.add(new Order(i, ascending ? "asc" : "desc"));
    }
  }
1035061
public void setSortOrder(boolean[] ascending) {
		PdfObject o = get(PdfName.S);
		if (o instanceof PdfArray) {
			if (((PdfArray)o).size() != ascending.length) {
				throw new IllegalArgumentException("The number of booleans in this array doesn't correspond with the number of fields.");
			}
			PdfArray array = new PdfArray();
			for (int i = 0; i < ascending.length; i++) {
				array.add(new PdfBoolean(ascending[i]));
			}
			put(PdfName.A, array);
		}
		else {
			throw new IllegalArgumentException("You need a single boolean for this collection sort dictionary.");
		}
	}
753297
public void setOrdering(com.google.api.ads.admanager.axis.v201808.CreativeWrapperOrdering ordering) {
        this.ordering = ordering;
    }
515357
private function initDirection()
    {
        if (null !== $this->orderBy) {
            switch ($this->direction) {
                case 'ASC':
                case 'DESC':
                    $this->orderBy = [$this->orderBy => $this->direction];
                    break;

                default:
                    throw new \InvalidArgumentException(sprintf('"direction" option should be set with "orderBy" and should be ASC or DESC'));
                    break;
            }
        }
    }
645468
def order_items(self, *args, **kwargs):
        """"""
        try:
            self._get_provider_session('assessment_basic_authoring_session').order_items(*args, **kwargs)
        except InvalidArgument:
            self._get_sub_package_provider_session(
                'assessment_authoring', 'assessment_part_item_design_session').order_items(*args, **kwargs)
93169
public boolean isOrderDeterministic() {
        // Leaf nodes need to re-implement this test.
        assert(m_children != null);
        for (AbstractPlanNode child : m_children) {
            if (! child.isOrderDeterministic()) {
                m_nondeterminismDetail = child.m_nondeterminismDetail;
                return false;
            }
        }
        return true;
    }