Returns top commands in queue. Does not remove anything from queue. This method can be used for
an admin tool to peek inside the queue.

@param count number of commands to lookup.
@return top commands in queue or empty list is nothing is found in queue.
430027
public List<Command> getTopCommands(int count, String queueName)  {
        checkStarted();
        List<Command> res = new ArrayList<>();

        try(Session session = consumerConnection.createSession()) {
            Queue queue = (Queue) jmsServer.lookup(QUEUE_NAMESPACE + queueName);
            Enumeration messages = session.createBrowser(queue).getEnumeration();
            for(int i = 0; i < count && messages.hasMoreElements(); i++) {
                Command command;
                Message message = (Message) messages.nextElement();
                if(binaryMode){
                    command = Command.fromBytes(getBytes((BytesMessage) message));
                }else{
                    command = Command.fromXml(((TextMessage)message).getText());
                }
                command.setJMSMessageID(message.getJMSMessageID());
                res.add(command);
            }
            return res;
        } catch (Exception e) {
            throw new AsyncException("Could not lookup commands", e);
        }
    }
1263171
public Long getTotalTargetCountByStatus(final Status status) {
        final Long count = statusTotalCountMap.get(status);
        return count == null ? 0L : count;
    }
942439
public Histogram<T> setBucketCount( int count ) {
        if (count != this.bucketCount) {
            this.bucketCount = count;
            this.bucketWidth = null;
            this.buckets.clear();
        }
        return this;
    }
730385
public <K, V> void build(CommandArgs<K, V> args, Long count, K... queues) {

        // GETJOB [NOHANG] [TIMEOUT <ms-timeout>] [COUNT <count>] [WITHCOUNTERS] FROM queue1 queue2 ... queueN

        if (noHang != null && noHang.booleanValue()) {
            args.add(CommandKeyword.NOHANG.bytes);
        }

        if (timeout != null) {
            args.add(CommandKeyword.TIMEOUT.bytes).add(timeout);
        }

        if (count != null && count.longValue() != 1L) {
            args.add(CommandKeyword.COUNT.bytes).add(count);
        }

        if (withCounters != null && withCounters.booleanValue()) {
            args.add(CommandKeyword.WITHCOUNTERS.bytes);
        }
        args.add(CommandKeyword.FROM.bytes).addKeys(queues);
    }
314760
public long getMessageCount(String queue){
        try {
            return getQueueControl(queue).getMessageCount();
        } catch (Exception e) {
            throw new AsyncException(e);
        }
    }
698454
public CountQueryResult executeCount() {
		CountQueryResult ret = new CountQueryResult(this);
		Object so = this.queryExecutor.getMappingInfo().getInternalDomainAccess().getSyncObject();
		if (so != null) {
			synchronized (so) {
				this.queryExecutor.executeCount();
			}
		} else
			this.queryExecutor.executeCount();
		return ret;
	}
132452
public int getOperationCount()
    {
        int count = _operations.size();
        if (_superClass != null)
            count += _superClass.getOperationCount();

        return count;
    }
866645
function get(command) {
        var commandID;
        if (!command) {
            console.error("Attempting to get a Sort method with a missing required parameter: command");
            return;
        }

        if (typeof command === "string") {
            commandID = command;
        } else {
            commandID = command.getID();
        }
        return _sorts[commandID];
    }
951458
@Override
	public int count() {
		try (Stream<?> paramStream = stream) {
			int count = paramStream.map(r -> {
				Map<String, Object> m = toMap(r);
				paramMap(m);
				context().addBatch();
				return condition.test(context(), m) ? executeBatch() : 0;
			}).reduce(0, (joined, element) -> joined + element);
			return count + (context().batchCount() != 0 ? executeBatch() : 0);
		} finally {
			stream = null;
			condition = DEFAULT_BATCH_WHEN_CONDITION;
			batchAction = DEFAULT_BATCH_ACTION;
			errorAction = DEFAULT_ERROR_ACTION;
		}
	}
1223661
public static <T extends TOP> int count(final Class<T> type, final JCas aJCas)
    {
        return JCasUtil.select(aJCas, type).size();
    }
1202964
public int count(List<String> statusList) {
        Map<String, Object> request = new HashMap<>();
        request.put("offset", 0);
        request.put("count", 1);
        if (statusList != null && !statusList.isEmpty()) {
            request.put("status_list", statusList);
        }

        String url = WxEndpoint.get("url.card.list");
        String json = JsonMapper.defaultMapper().toJson(request);
        String response = wxClient.post(url, json);

        Map<String, Object> result = JsonMapper.defaultMapper().json2Map(response);
        if (result.containsKey("total_num")) {
            return (Integer) result.get("total_num");
        } else {
            throw new WxRuntimeException(999, "create card failed.");
        }
    }
1318154
int get_command(final long tout) {
	int ret;

	// Wait on monitor
	if (shared_cmd.cmd_pending == false && shared_cmd.trigger == false) {
	    if (works.size() == 0) {
		p_mon.wait_it();
	    } else if (tout > 0) {
		p_mon.wait_it(tout);
	    }
	}

	// Test if it is a new command. If yes, copy its data locally
	if (shared_cmd.cmd_pending == true) {
	    local_cmd = shared_cmd;
	    ret = POLL_COMMAND;
	} else if (shared_cmd.trigger == true) {
	    local_cmd = shared_cmd;
	    ret = POLL_TRIGGER;
	} else {
	    ret = POLL_TIME_OUT;
	}

	return ret;
    }
243668
public List getControlsFor(Command command) {
		List controlsForCommand = new ArrayList();

		for (Iterator it = commands.entrySet().iterator(); it.hasNext();) {
			Map.Entry entry = (Map.Entry) it.next();
			Control key = (Control) entry.getKey();
			Command value = (Command) entry.getValue();

			if (value == command) {
				controlsForCommand.add(key);
			}
		}
		return controlsForCommand;
	}
555010
public static List<String> getWords(int count, boolean startLorem) {
        LinkedList<String> wordList = new LinkedList<String>();

        if (startLorem) {
            if (count > COMMON_WORDS.length) {
                wordList.addAll(Arrays.asList(COMMON_WORDS));

            } else {
                // add first "count" words
                for (int i = 0; i < count; i++) {
                    wordList.add(COMMON_WORDS[i]);
                }
            }
        }

        // add remaining words (random)
        for (int i = wordList.size(); i < count; i++) {
            wordList.add(QuickUtils.math.getRandomPosition(DICTIONARY));
        }

        return wordList;
    }
1136359
public int countRankOnes(int location) {

    int count = 0;
    for (int i = 0; i < populationSize; i++) {
      if (rankIdx[location][i] == 1) {
        count++;
      }
    }

    return count;
  }
168189
public static List<String> cmd(String[] command) throws IOException, InterruptedException {
        return cmd(command, null, null, 300000L, null);
    }
22570
private static String commandRun(Command command) {
        // Wait bind
        if (I_COMMAND == null) {
            synchronized (I_LOCK) {
                if (I_COMMAND == null) {
                    try {
                        I_LOCK.wait();
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        }

        // Cancel Destroy Service
        cancelDestroyService();

        // Get result
        // In this we should try 5 count get the result
        int count = 5;
        Exception error = null;
        while (count > 0) {
            if (command.isCancel) {
                if (command.mListener != null)
                    command.mListener.onCancel();
                break;
            }
            try {
                command.mResult = I_COMMAND.command(command.mId, command.mTimeout, command.mParameters);
                if (command.mListener != null)
                    command.mListener.onCompleted(command.mResult);
                break;
            } catch (Exception e) {
                error = e;
                count--;
                try {
                    Thread.sleep(3000);
                } catch (InterruptedException e1) {
                    e1.printStackTrace();
                }
            }
        }

        // Check is Error
        if (count <= 0 && command.mListener != null) {
            command.mListener.onError(error);
        }

        // Check is end and call destroy service
        if (I_COMMAND != null) {
            try {
                if (I_COMMAND.getTaskCount() <= 0)
                    destroyService();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        // Return
        return command.mResult;
    }