#region "orderByDescending" Order elements using provided expression
969064
function orderByDescending(expression) {

        //Check arguments
        if (!expression)
            throw new Error("Expression is invalid");
			
		//Use "orderBy" method
		var ordered = jslinq(this.items)
			.orderBy(expression)
			.toList();
		
		//Reverse order of array
		var outData = ordered.reverse();

        //Return for chaining
        return new jslinq(outData);
    }
1605
public static <C extends Comparable> Ordering<Range<C>> reverseOrderingByUpperEndpoint() {
        Ordering<Range<C>> orderingByUpperEndpoint = orderingByUpperEndpoint();
        return orderingByUpperEndpoint.reverse();
    }
298637
function orderBy(array, sortPredicate, reverseOrder) {
  if (!isArrayLike(array)) {
    return array;
  }
  sortPredicate = isArray(sortPredicate) ? sortPredicate : [sortPredicate];
  if (sortPredicate.length === 0) { sortPredicate = ['+']; }
  sortPredicate = sortPredicate.map(function(predicate) {
    var descending = false;
    var get = predicate || value;
    if (isString(predicate)) {
      if ((predicate.charAt(0) == '+' || predicate.charAt(0) == '-')) {
        descending = predicate.charAt(0) == '-';
        predicate = predicate.substring(1);
      }
      if (predicate === '') {
        // Effectively no predicate was passed so we compare identity
        return reverseComparator(function(a, b) {
          return compare(a, b);
        }, descending);
      }
      get = $parse(predicate);
      if (get.constant) {
        var key = get();
        return reverseComparator(function(a, b) {
          return compare(a[key], b[key]);
        }, descending);
      }
    }
    return reverseComparator(function(a, b) {
      return compare(get(a),get(b));
    }, descending);
  });
  var arrayCopy = [];
  for (var i = 0; i < array.length; i++) { arrayCopy.push(array[i]); }
  return arrayCopy.sort(reverseComparator(comparator, reverseOrder));

  function comparator(o1, o2) {
    for (var i = 0; i < sortPredicate.length; i++) {
      var comp = sortPredicate[i](o1, o2);
      if (comp !== 0) break;
    }
    return comp;
  }
  function reverseComparator(comp, descending) {
    return descending
      ? function(a, b) {return comp(b,a);}
      : comp;
  }
  function compare(v1, v2) {
    var t1 = typeof v1;
    var t2 = typeof v2;
    if (t1 == t2) {
      if (isDate(v1) && isDate(v2)) {
        v1 = v1.valueOf();
        v2 = v2.valueOf();
      }
      if (t1 == "string") {
        v1 = v1.toLowerCase();
        v2 = v2.toLowerCase();
      }
      if (v1 === v2) return 0;
      return v1 < v2 ? -1 : 1;
    } else {
      return t1 < t2 ? -1 : 1;
    }
  }
}
802002
public void postProcess() {
    if (!this.isEmptySlot()) {

      switch (savedItem.getExpressionItemType()) {
        case OPERATOR: {
          if (savedItem == OPERATOR_SUB) {
            if (!childElements[0].isEmptySlot() && childElements[1].isEmptySlot()) {
              final ExpressionTreeElement left = childElements[0];
              final ExpressionItem item = left.getItem();
              if (item.getExpressionItemType() == ExpressionItemType.VALUE) {
                final Value val = (Value) item;
                switch (val.getType()) {
                  case INT: {
                    childElements = EMPTY;
                    savedItem = Value.valueOf(0 - val.asLong());
                    makeMaxPriority();
                  }
                  break;
                  case FLOAT: {
                    childElements = EMPTY;
                    savedItem = Value.valueOf(0.0f - val.asFloat());
                    makeMaxPriority();
                  }
                  break;
                  default: {
                    if (!left.isEmptySlot()) {
                      left.postProcess();
                    }
                  }
                  break;
                }
              }
            } else {
              for (final ExpressionTreeElement element : childElements) {
                if (!element.isEmptySlot()) {
                  element.postProcess();
                }
              }
            }
          } else {
            for (final ExpressionTreeElement element : childElements) {
              if (!element.isEmptySlot()) {
                element.postProcess();
              }
            }
          }
        }
        break;
        case FUNCTION: {
          for (final ExpressionTreeElement element : childElements) {
            if (!element.isEmptySlot()) {
              element.postProcess();
            }
          }
        }
        break;
      }
    }
  }
639738
function clickRegion( e ) {
	
	let pos 	= {
		x : e.clientX,
		y : e.clientY
	},
	region 		= '',
	dividant 	= 4,
	right  		= window.innerWidth - (window.innerWidth / dividant),
	left   		= (window.innerWidth / dividant),
	top    		= (window.innerHeight / dividant),
	bottom 		= window.innerHeight - (window.innerHeight / dividant);

	if( pos.y <= top ) { region = 'top'; }
	else if(  pos.y >= bottom ) { region = 'bottom'; }

	if( pos.x <= left ) { region = 'left'; }
	else if(  pos.x >= right ) { region = 'right'; }

	return region;
}
614318
private static void traverseExpression(final ognl.Node node, final Set<String> params) {
		if (node == null) {
			return;
		}
		if (node instanceof ASTProperty) {
			ASTProperty prop = (ASTProperty) node;
			params.add(prop.toString());
		} else {
			int childCount = node.jjtGetNumChildren();
			for (int i = 0; i < childCount; i++) {
				ognl.Node child = node.jjtGetChild(i);
				traverseExpression(child, params);
			}
		}
	}
655288
void resolveColumnReferencesInOrderBy(SortAndSlice sortAndSlice) {

        // replace the aliases with expressions
        // replace column names with expressions and resolve the table columns
        int orderCount = sortAndSlice.getOrderLength();

        for (int i = 0; i < orderCount; i++) {
            ExpressionOrderBy e =
                (ExpressionOrderBy) sortAndSlice.exprList.get(i);

            replaceColumnIndexInOrderBy(e);

            if (e.getLeftNode().queryTableColumnIndex != -1) {
                continue;
            }

            if (sortAndSlice.sortUnion) {
                if (e.getLeftNode().getType() != OpTypes.COLUMN) {
                    throw Error.error(ErrorCode.X_42576);
                }
            }

            e.replaceAliasInOrderBy(exprColumns, indexLimitVisible);
            resolveColumnReferencesAndAllocate(e, rangeVariables.length,
                                               false);
        }

        sortAndSlice.prepare(this);
    }
500041
function firstOrDefault(expression) {

        //Define output
		var outData;
		
		//If there's no expression
		if (!expression){
		
			//Just assign current items
			outData = this.items;
		}
		else{
		
			//Otherwise apply where condition
			outData = jslinq(this.items)
				.where(expression)
				.toList();
		}

        //If output list does not contains element, return null
        if (outData.length === 0)
            return null;
			
		//Return first element
		return outData[0];
    }
751936
public void parseSequenceFlowConditionExpression(Element seqFlowElement, TransitionImpl seqFlow) {
    Element conditionExprElement = seqFlowElement.element(CONDITION_EXPRESSION);
    if (conditionExprElement != null) {
      Condition condition = parseConditionExpression(conditionExprElement);
      seqFlow.setProperty(PROPERTYNAME_CONDITION_TEXT, conditionExprElement.getText().trim());
      seqFlow.setProperty(PROPERTYNAME_CONDITION, condition);
    }
  }
1353668
private void parseOrdering(String ordering) {
        final String comma = ",";
        final String space = " ";

        StringTokenizer tokenizer = new StringTokenizer(ordering, comma);

        sortOrders = new ArrayList<KunderaQuery.SortOrdering>();
        while (tokenizer.hasMoreTokens()) {
            String order = (String) tokenizer.nextElement();
            StringTokenizer token = new StringTokenizer(order, space);
            SortOrder orderType = SortOrder.ASC;

            String colName = (String) token.nextElement();
            while (token.hasMoreElements()) {
                String nextOrder = (String) token.nextElement();

                // more spaces given.
                if (StringUtils.isNotBlank(nextOrder)) {
                    try {
                        orderType = SortOrder.valueOf(nextOrder.toUpperCase());
                    } catch (IllegalArgumentException e) {
                        logger.error("Error while parsing order by clause:");
                        throw new JPQLParseException("Invalid sort order provided:" + nextOrder);
                    }
                }
            }
            sortOrders.add(new SortOrdering(colName, orderType));
        }
    }
1036272
function orderObject (unordered) {
  const ordered = {}
  if (typeof unordered !== 'object' || unordered == null || Array.isArray(unordered)) return unordered
  Object.keys(unordered).sort().forEach(function (key) {
    ordered[key] = ((typeof unordered[key] === 'object') && !Array.isArray(unordered[key])) ? orderObject(unordered[key]) : unordered[key]
  })
  return ordered
}
1368527
public static <E extends Comparable<E>> void sortDescending(E[] intArray) {
        Merge.sort(intArray, 0, intArray.length-1, true);
    }
660195
function (order) {
            var ret = order;
            if (order) {
                ret = order.map(function (o) {
                    if (isInstanceOf(o, OrderedExpression)) {
                        return o.invert();
                    } else {
                        return new OrderedExpression(isString(o) ? new Identifier(o) : o);
                    }
                }, this);
            }
            return ret;
        }
1139450
public static <C extends Comparable> Ordering<Range<C>> reverseOrderingByLowerEndpoint() {
        Ordering<Range<C>> orderingByLowerEndpoint = orderingByLowerEndpoint();
        return orderingByLowerEndpoint.reverse();
    }
537445
private void endExpression(int position) throws MalformedUriTemplateException
    {

        // an expression close brace is found without a start
        if (startedTemplate)
        {
            if (!expressionCaptureOn)

            {
                throw new MalformedUriTemplateException("Expression close brace was found at position " + position
                + " yet there was no start brace.", position);
            }
            expressionCaptureOn = false;
            components.add(new Expression(buffer.toString(), this.startPosition));
            buffer = null;
        }
        else
        {
            throw new IllegalStateException("Cannot end an expression without beginning the template");
        }
    }
987444
function xpathSort(input, sort) {
    if (sort.length === 0) {
        return;
    }
    var sortlist = [];
    var i;
    for (i = 0; i < input.contextSize(); ++i) {
        var node = input.nodelist[i];
        var sortitem = {node: node, key: []};
        var context = input.clone(node, 0, [node]);

        for (var j = 0; j < sort.length; ++j) {
            var s = sort[j];
            var value = s.expr.evaluate(context);

            var evalue;
            if (s.type === 'text') {
                evalue = value.stringValue();
            } else if (s.type === 'number') {
                evalue = value.numberValue();
            }
            sortitem.key.push({value: evalue, order: s.order});
        }

        // Make the sort stable by adding a lowest priority sort by
        // id. This is very convenient and furthermore required by the
        // spec ([XSLT] - Section 10 Sorting).
        sortitem.key.push({value: i, order: 'ascending'});

        sortlist.push(sortitem);
    }

    sortlist.sort(xpathSortByKey);

    var nodes = [];
    for (i = 0; i < sortlist.length; ++i) {
        nodes.push(sortlist[i].node);
    }
    input.nodelist = nodes;
    input.setNode(0);
}
712875
public Query orderby(final Expression... orderbyColumns) {
        if (orderbyColumns == null) {
            return this;
        }

        return orderby(Arrays.asList(orderbyColumns));
    }