Prompts for and returns a selected history entry or if the <code>-n</code> option is passed that history entry is returned.

@param history
@return
509179
private HistoryEntry processIndex(List<HistoryEntry> history) {
    log.debug("I received entry: "+index);
    HistoryEntry selectedEntry = null;
    if(index != null && index > 0) {
      for(HistoryEntry entry : history) {
        if(entry.getIndex() == index) {
          if(!entry.isRevertible()) {
            System.err.println("Selected index ["+index+"] is not revertible.");
            index = null;
          } else {
            selectedEntry = entry;
          }
          break;
        }
      }
      if(index == null) {
        selectedEntry = null;
      } else if(selectedEntry == null) {
        System.err.println("Invalid entry!");
        index = null;
      }
    } else if(index != null && index < 0) {
      for(HistoryEntry entry : history) {
        if(entry.isRevertible()) {
          if(index++ == 0) {
            selectedEntry = entry;
            index = entry.getIndex();
            break;
          }
        }
      }
      if(selectedEntry == null) {
        System.err.println("Invalid entry!");
        index = null;
      }
    } else {
      index = null;
      System.err.println("Invalid entry!");
    }
    return selectedEntry;
  }
945915
@Override
  public UserTrades getTradeHistory(TradeHistoryParams tradeHistoryParams) throws IOException {
    HuobiOrder[] openOrders = getHuobiTradeHistory(null);
    return HuobiAdapters.adaptTradeHistory(openOrders);
  }
12287
def prompt(self, msg):
        """"""
        try:
            # prompt_toolkit v2
            prompt = prompt_toolkit.PromptSession(history=self.history).prompt
        except AttributeError:
            # prompt_toolkit v1
            prompt = partial(prompt_toolkit.prompt, history=self.history)
        return prompt(
            msg,
            multiline=self.multiline,
            vi_mode=self.vi_mode,
            wrap_lines=self.wrap_lines,
            enable_history_search=self.history_search,
            lexer=PygmentsLexer(CoconutLexer),
            style=style_from_pygments_cls(
                pygments.styles.get_style_by_name(self.style),
            ),
        )
1065825
public void addHistory(Object historyKey)
    {
        if (this.history == null)
        {
            this.history = new KeyHistory();
        }

        this.history.addKey(historyKey.toString());
    }
1011911
def append_to_history(self):
        
        # Validate first. If not valid, set validation exception.
        if not self.validate():
            return

        # Save at the tail of the history. (But don't if the last entry the
        # history is already the same.)
        if self.text and (not len(self.history) or self.history[-1] != self.text):
            self.history.append(self.text)
690269
public static systemeventhistory[] get(nitro_service service, systemeventhistory_args args) throws Exception{
		systemeventhistory obj = new systemeventhistory();
		options option = new options();
		option.set_args(nitro_util.object_to_string_withoutquotes(args));
		systemeventhistory[] response = (systemeventhistory[])obj.get_resources(service, option);
		return response;
	}
1168064
def history(params = {})
      params.select! { |key, _value| @api.history_config[:allowed_params].include? key }

      response = self.class.get(@api.history_config[:url],
                                :query => { :auth_token => @token }.merge(params),
                                :headers => @api.headers
      )

      ErrorHandler.response_code_to_exception_for :user, user_id, response
      response.body
    end
447280
function(historyinfo){
		this.allerase();
		
		this.initpos = this.position = historyinfo.current || 0;
		this.history = [];
		var datas = historyinfo.datas || [];
		for(var i=0,len=datas.length;i <len;i++){
			var opelist = new this.klass.OperationList();
			this.history.push(opelist);
			var array = datas[i];
			if(array.time!==void 0){
				opelist.time = array.time;
				array = array.ope;
			}
			for(var j=0,len2=array.length;j <len2;j++){
				var strs = array[j].split(/,/);
				var ope = null, List = this.operationlist;
				for(var k=0;k <List.length;k++){
					var ope1 = new List[k]();
					if(ope1.decode(strs)){ ope = ope1; break;}
				}
				if(!!ope){
					opelist.push(ope);
					this.lastope = ope;
				}
			}
		}
		
		this.checkexec();
		
		this.trialpos = historyinfo.trialpos || [];
		if(this.trialpos.length>0){
			this.resumeTrial();
			this.limitTrialUndo = true;
		}
	}
811869
protected List<Entry> getList (Name username)
    {
        if (username instanceof KeepNoHistory) {
            return null;
        }
        List<Entry> history = _histories.get(username);
        if (history == null) {
            _histories.put(username, history = Lists.newArrayList());
        }
        return history;
    }
446835
@Override
  public UserTrades getTradeHistory(TradeHistoryParams params) throws IOException {

    Long from = null;
    Long to = null;
    if (params instanceof TradeHistoryParamsTimeSpan) {
      TradeHistoryParamsTimeSpan p = (TradeHistoryParamsTimeSpan) params;
      from = DateUtils.toMillisNullSafe(p.getStartTime());
      to = DateUtils.toMillisNullSafe(p.getEndTime());
    }
    return getTradeHistory(from, to);
  }
796971
def _cursorUp(self):
        
        if self.historyPos > 0:
            self.historyPos -= 1
            clearLen = len(self.inputBuffer)
            self.inputBuffer = list(self.history[self.historyPos])
            self.cursorPos = len(self.inputBuffer)
            self._refreshInputPrompt(clearLen)
1266895
def previous_history(self, current): # (C-p)
         '''
        if self.history_cursor == len(self.history):
            self.history.append(current.copy()) #do not use add_history since we do not want to increment cursor
            
        if self.history_cursor > 0:
            self.history_cursor -= 1
            current.set_line(self.history[self.history_cursor].get_line_text())
            current.point = lineobj.EndOfLine
1343664
public ActivityRecords history(String streamKey, long start, long end) throws QiniuException {
        if (start <= 0 || end < 0 || (start >= end && end != 0)) {
            throw new QiniuException(new IllegalArgumentException("bad argument" + start + "," + end));
        }
        String path = encodeKey(streamKey) + "/historyactivity?start=" + start;
        if (end != 0) {
            path += "&end=" + end;
        }
        return get(path, ActivityRecords.class);
    }
867383
protected History[] constructHistory(BasicNameValuePair[] params) throws Exception {
        String uri = HISTORY + uriEncode(_profileName);

        try {
            JSONObject response = new JSONObject(doGet(uri, params));
            JSONArray historyArray = response.getJSONArray("history");
            history = new History[historyArray.length()];

            for (int i = 0; i < historyArray.length(); i++) {
                history[i] = new History();
                JSONObject jsonHistory = historyArray.getJSONObject(i);
                if (jsonHistory == null) {
                    continue;
                }

                if (!jsonHistory.isNull("id")) {
                    history[i].setId(jsonHistory.getInt("id"));
                }
                if (!jsonHistory.isNull("profileId")) {
                    history[i].setProfileId(jsonHistory.getInt("profileId"));
                }
                if (!jsonHistory.isNull("clientUUID")) {
                    history[i].setClientUUID(jsonHistory.getString("clientUUID"));
                }
                if (!jsonHistory.isNull("createdAt")) {
                    history[i].setCreatedAt(jsonHistory.getString("createdAt"));
                }
                if (!jsonHistory.isNull("requestType")) {
                    history[i].setRequestType(jsonHistory.getString("requestType"));
                }
                if (!jsonHistory.isNull("requestURL")) {
                    history[i].setRequestURL(jsonHistory.getString("requestURL"));
                }
                if (!jsonHistory.isNull("requestParams")) {
                    history[i].setRequestParams(jsonHistory.getString("requestParams"));
                }
                if (!jsonHistory.isNull("requestPostData")) {
                    history[i].setRequestPostData(jsonHistory.getString("requestPostData"));
                }
                if (!jsonHistory.isNull("requestHeaders")) {
                    history[i].setRequestHeaders(jsonHistory.getString("requestHeaders"));
                }
                if (!jsonHistory.isNull("responseCode")) {
                    history[i].setResponseCode(jsonHistory.getString("responseCode"));
                }
                if (!jsonHistory.isNull("responseHeaders")) {
                    history[i].setResponseHeaders(jsonHistory.getString("responseHeaders"));
                }
                if (!jsonHistory.isNull("responseContentType")) {
                    history[i].setResponseContentType(jsonHistory.getString("responseContentType"));
                }
                if (!jsonHistory.isNull("originalRequestURL")) {
                    history[i].setOriginalRequestURL(jsonHistory.getString("originalRequestURL"));
                }
                if (!jsonHistory.isNull("originalRequestParams")) {
                    history[i].setOriginalRequestParams(jsonHistory.getString("originalRequestParams"));
                }
                if (!jsonHistory.isNull("originalRequestPostData")) {
                    history[i].setOriginalRequestPostData(jsonHistory.getString("originalRequestPostData"));
                }
                if (!jsonHistory.isNull("originalRequestHeaders")) {
                    history[i].setOriginalRequestHeaders(jsonHistory.getString("originalRequestHeaders"));
                }
                if (!jsonHistory.isNull("originalResponseCode")) {
                    history[i].setOriginalResponseCode(jsonHistory.getString("originalResponseCode"));
                }
                if (!jsonHistory.isNull("originalResponseHeaders")) {
                    history[i].setOriginalResponseHeaders(jsonHistory.getString("originalResponseHeaders"));
                }
                if (!jsonHistory.isNull("originalResponseContentType")) {
                    history[i].setResponseContentType(jsonHistory.getString("originalResponseContentType"));
                }
                if (!jsonHistory.isNull("modified")) {
                    history[i].setModified(jsonHistory.getBoolean("modified"));
                }
                if (!jsonHistory.isNull("requestBodyDecoded")) {
                    history[i].setRequestBodyDecoded(jsonHistory.getBoolean("requestBodyDecoded"));
                }
                if (!jsonHistory.isNull("responseBodyDecoded")) {
                    history[i].setResponseBodyDecoded(jsonHistory.getBoolean("responseBodyDecoded"));
                }
                if (!jsonHistory.isNull("extraInfo")) {
                    history[i].setExtraInfoFromString(jsonHistory.getString("extraInfo"));
                }
                /**
                 * To get the json responseData make a call specifically using the id
                 */

                int id = history[i].getId();
                String idUri = uri + "/" + id;
                JSONObject historyId = new JSONObject(doGet(idUri, null));

                String responseData = historyId.getJSONObject("history").getString("responseData");
                history[i].setResponseData(responseData);
                String originalResponseData = historyId.getJSONObject("history").getString("originalResponseData");
                history[i].setOriginalResponseData(originalResponseData);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return history;
    }
654353
public Optional<SingularityTaskHistory> getHistoryForTask(String taskId) {
    final Function<String, String> requestUri = (host) -> String.format(TASK_HISTORY_FORMAT, getApiBase(host), taskId);

    return getSingle(requestUri, "task history", taskId, SingularityTaskHistory.class);
  }
684328
@Override
  public UserTrades getTradeHistory(TradeHistoryParams params) throws IOException {
    int pageNumber = ((TradeHistoryParamPaging) params).getPageNumber() + 1;
    return IndependentReserveAdapters.adaptTradeHistory(
        getIndependentReserveTradeHistory(pageNumber));
  }
390270
@Override
    public File historyFile() {
        if(historyFile == null) {
            return new File(System.getProperty("user.home")+
                    Config.getPathSeparator()+".aesh_history");
        }
        else
            return historyFile;
    }