Updates the command list and the buffer.

@param   commandList
The command list to update
@param   buffer
The input buffer
@param   endIndex
The end index in the buffer
@param   typeSpace
True space, false for quote
@return  The updated buffer
967886
protected StringBuilder addPart(List<String> commandList,StringBuilder buffer,int endIndex,boolean typeSpace)
    {
        int delta=1;
        if(typeSpace)
        {
            delta=0;
        }
        
        String part=buffer.substring(delta,endIndex);
        commandList.add(part);
        buffer.delete(0,endIndex+delta);

        return buffer;
    }
632076
@Indexable(type = IndexableType.REINDEX)
	@Override
	public CommercePriceList updateCommercePriceList(
		CommercePriceList commercePriceList) {
		return commercePriceListPersistence.update(commercePriceList);
	}
121552
@Override
	public void endElement(String namespaceURI, String localeName, String tagName) throws SAXException
	{
		Command cmd = stack.pop();
		// cmd.setTabCount(tabCount);

		// find if command works in context
		if (!stack.isEmpty())
		{
			Command ctx = stack.peek();
			ctx.addChild(cmd);
		}

		// upper level commands
		if (stack.size() == 1 && cmd.isExecutable())
		{
			commands.add(cmd);
		}

		// store reference to command
		if (cmd.hasAttr("id")) { //$NON-NLS-1$
			references.put(cmd.getAttr("id"), cmd); //$NON-NLS-1$
		}

		try
		{
			cmd.exec(references);
		}
		catch (Exception e)
		{
			SAXException e2 = new SAXException(e.getMessage());

			e2.initCause(e);
			throw e2;
		}

		if (--tabCount < 0)
		{
			tabCount = 0;
		}

		Command.prn(tabCount, tabCount + ">...<" + tagName + "> end"); //$NON-NLS-1$ //$NON-NLS-2$
	}
814430
@Override
	public List<String> listCommands( String app ) {

		this.logger.fine("Request: list all the commands in the " + app + " application.");
		List<String> result;
		Application application = this.manager.applicationMngr().findApplicationByName( app );
		if( application == null )
			result = new ArrayList<>( 0 );
		else
			result = this.manager.commandsMngr().listCommands( application );

		return result;
	}
1344162
public boolean nextIndex(long index) {
    if (operationIndex + 1 == index) {
      currentOperation = OperationType.COMMAND;
      operationIndex++;
      return true;
    }
    return false;
  }
421663
private void addList(StringBuffer buffer, BufferedReader reader) throws IOException {
    char[] lastBullet = new char[0];
    String line = null;
    while ((line = reader.readLine()) != null) {
      // no nested list handling, trim lines:
      line = line.trim();
      if (line.length() == 0) {
        continue;
      }

      int bulletEnd = line.indexOf(' ');
      if (bulletEnd < 1) {
        continue;
      }
      if ( line.charAt(bulletEnd - 1) == '.') {
        bulletEnd--;
      }
      char[] bullet = line.substring(0, bulletEnd).toCharArray();
      // Logger.log("found bullet: ('" + new String(lastBullet) + "') '" + new String(bullet) + "'");
      // check whether we find a new list
      int sharedPrefixEnd;
      for (sharedPrefixEnd = 0; ; sharedPrefixEnd++) {
        if (bullet.length <= sharedPrefixEnd || lastBullet.length <= sharedPrefixEnd ||
          +bullet[sharedPrefixEnd] != lastBullet[sharedPrefixEnd]) {
          break;
        }
      }

      for (int i = sharedPrefixEnd; i < lastBullet.length; i++) {
        //Logger.log("closing " + lastBullet[i]);
        buffer.append(closeList.get(new Character(lastBullet[i]))).append("\n");
      }

      for (int i = sharedPrefixEnd; i < bullet.length; i++) {
        //Logger.log("opening " + bullet[i]);
        buffer.append(openList.get(new Character(bullet[i]))).append("\n");
      }
      buffer.append("<li>");
      buffer.append(line.substring(line.indexOf(' ') + 1));
      buffer.append("</li>\n");
      lastBullet = bullet;
    }

    for (int i = lastBullet.length - 1; i >= 0; i--) {
      //Logger.log("closing " + lastBullet[i]);
      buffer.append(closeList.get(new Character(lastBullet[i])));
    }
  }
1203228
public T handle(List<QueryParameters> outputList) {
        Number result = 0;

        if (outputList == null || outputList.isEmpty() == true) {
            throw new IllegalArgumentException("Error! Output should always contain at least one element");
        }

        QueryParameters stmtParams = outputList.get(0);

        if (stmtParams.containsKey(HandlersConstants.STMT_UPDATE_COUNT) == false) {
            throw new IllegalArgumentException("Error! Expected to get update count, but key wasn't found!");
        }

        result = (Integer) stmtParams.getValue(HandlersConstants.STMT_UPDATE_COUNT);

        return (T) result;
    }
494664
public boolean scrollListToTop(AbsListView list) {
		if(config.commandLogging){
			Log.d(config.commandLoggingTag, "scrollListToTop("+list+")");
		}
		
		return scroller.scrollList(list, Scroller.UP, true);
	}
279908
public boolean scrollListToBottom(int index) {
		if(config.commandLogging){
			Log.d(config.commandLoggingTag, "scrollListToBottom("+index+")");
		}
		
		return scroller.scrollList(waiter.waitForAndGetView(index, ListView.class), Scroller.DOWN, true);
	}
424153
@Indexable(type = IndexableType.REINDEX)
	@Override
	public CommerceWishList updateCommerceWishList(
		CommerceWishList commerceWishList) {
		return commerceWishListPersistence.update(commerceWishList);
	}
693722
public static <T extends JCGLBufferWritableType> JCGLBufferUpdateType<T>
  newUpdateReplacingAll(final T buffer)
  {
    NullCheck.notNull(buffer, "Buffer");
    return newUpdateReplacingRange(buffer, buffer.byteRange());
  }
247069
@Override
    void completeCandidates(CommandContext ctx, String buffer, int cursor, List<String> candidates) {
        if (candidates.isEmpty()) {
            if (buffer.startsWith("\"") && buffer.length() >= 2) {
                // Quotes are added back by super class.
                buffer = buffer.substring(1);
            }
            if (buffer.length() == 2 && buffer.endsWith(":")) {
                candidates.add(buffer + File.separator);
            }
        }
    }
868963
public boolean scrollDownList(AbsListView list) {
		if(config.commandLogging){
			Log.d(config.commandLoggingTag, "scrollDownList("+list+")");
		}
		
		return scroller.scrollList(list, Scroller.DOWN, false);
	}
227552
protected void flushBuffer(boolean commandEnd) throws IOException {
    if (pos > 4) {
      buf[0] = (byte) (pos - 4);
      buf[1] = (byte) ((pos - 4) >>> 8);
      buf[2] = (byte) ((pos - 4) >>> 16);
      buf[3] = (byte) this.seqNo++;
      checkMaxAllowedLength(pos - 4);
      out.write(buf, 0, pos);
      cmdLength += pos - 4;

      if (traceCache != null && permitTrace) {
        //trace last packets
        traceCache.put(new TraceObject(true, NOT_COMPRESSED,
            Arrays.copyOfRange(buf, 0, pos > 1000 ? 1000 : pos)));
      }

      if (logger.isTraceEnabled()) {
        if (permitTrace) {
          logger.trace("send: {}{}",
              serverThreadLog,
              Utils.hexdump(maxQuerySizeToLog, 0, pos, buf));
        } else {
          logger.trace("send: content length={} {} com=<hidden>",
              pos - 4,
              serverThreadLog);
        }
      }

      //if last com fill the max size, must send an empty com to indicate command end.
      if (commandEnd && pos == MAX_PACKET_LENGTH) {
        writeEmptyPacket();
      }

      pos = 4;
    }
  }
1104995
public void pushCommandLine(String commandLine) {
        // Add new history entry to the end.
        history.add(commandLine);

        // Maintain max history size.
        if (history.size() > maxHistory) {
            history.remove(0);
        }

        // Reset the iteration index.
        resetCurrentIndex();
    }
643489
public DevCmdInfo_2[] command_list_query_2() {
	Util.out4.println("Device_2Impl.command_list_query_2 arrived");

	// Retrieve number of command and allocate memory to send back info
	final Vector cmd_list = device_class.get_command_list();
	Util.out4.println(cmd_list.size() + " command(s) for device");
	final DevCmdInfo_2[] back = new DevCmdInfo_2[cmd_list.size()];

	for (int i = 0; i < cmd_list.size(); i++) {
	    final Command cmd = (Command) cmd_list.elementAt(i);
	    final DevCmdInfo_2 tmp = new DevCmdInfo_2();
	    tmp.cmd_name = cmd.get_name();
	    tmp.cmd_tag = cmd.get_tag();
	    tmp.level = cmd.get_disp_level();
	    tmp.in_type = cmd.get_in_type();
	    tmp.out_type = cmd.get_out_type();
	    final String str_in = cmd.get_in_type_desc();
	    if (str_in != null) {
		tmp.in_type_desc = str_in;
	    } else {
		tmp.in_type_desc = Tango_DescNotSet;
	    }
	    final String str_out = cmd.get_out_type_desc();
	    if (str_out != null) {
		tmp.out_type_desc = str_out;
	    } else {
		tmp.out_type_desc = Tango_DescNotSet;
	    }
	    back[i] = tmp;
	}
	// Record operation request in black box
	blackbox.insert_op(Op_Command_list_2);

	Util.out4.println("Device_2Impl.command_list_query_2 exiting");
	return back;

    }
369904
private void addToIndex(Map<String, String> param) throws Exception {
        String doc = writeUpdateString(param);
        addToBuffer(doc);
    }