/** * Append an integer, formatted as two digits, to a string buffer * * @param sb the string buffer * @param value the integer to be formatted (must be in the range 0..99 */ static void appendTwoDigits(/*@NotNull*/ FastStringBuffer sb, int value) { sb.append((char) (value / 10 + '0')); sb.append((char) (value % 10 + '0')); }
/** * Create a FastStringBuffer with initial content * * @param cs the initial content. The buffer is created with just enough capacity for * this content (it will be expanded if more content is added later). */ public FastStringBuffer(CharSequence cs) { array = new char[cs.length()]; append(cs); }
/** * Append an integer, formatted with leading zeros to a fixed size, to a string buffer * * @param sb the string buffer * @param value the integer to be formatted * @param size the number of digits required (max 9) */ static void appendString(/*@NotNull*/ FastStringBuffer sb, int value, int size) { String s = "000000000" + value; sb.append(s.substring(s.length() - size)); }
/** * Get a character string that uniquely identifies this node. * Note: a.isSameNode(b) if and only if generateId(a)==generateId(b) * * @param buffer buffer to hold a string that uniquely identifies this node, across all * documents. */ public void generateId(/*@NotNull*/ FastStringBuffer buffer) { element.generateId(buffer); buffer.append("n"); buffer.append(Integer.toString(position)); }
private void format(LinkedList<PrimitiveUType> list, FastStringBuffer fsb, Function<ItemType, String> show) { if (list.size() == 1) { fsb.append(list.get(0).toItemType().toString()); } else { fsb.append('('); fsb.append(list.removeFirst().toItemType().toString()); fsb.append('|'); format(list, fsb, show); fsb.append(')'); } }
private static String showNamespaces(HashSet<NamespaceBinding> bindings) { FastStringBuffer sb = new FastStringBuffer(256); for (NamespaceBinding binding : bindings) { sb.append(binding.getPrefix()); sb.append("="); sb.append(binding.getURI()); sb.append(" "); } sb.setLength(sb.length()-1); return sb.toString(); }
public String toString() { FastStringBuffer fsb = new FastStringBuffer(FastStringBuffer.C64); fsb.append("order by ... "); return fsb.toString(); }
public StringValue call(XPathContext context, Sequence[] arguments) throws XPathException { FastStringBuffer fsb = new FastStringBuffer(FastStringBuffer.C64); for (Sequence<?> arg : arguments) { Item item = arg.head(); if (item != null) { fsb.append(item.getStringValueCS()); } } return new StringValue(fsb); }
public String listComponentReferences(Map<Component, Integer> componentIdMap) { FastStringBuffer fsb = new FastStringBuffer(128); for (ComponentBinding ref : getComponentBindings()) { Component target = ref.getTarget(); int targetId = obtainComponentId(target, componentIdMap); if (fsb.length() != 0) { fsb.append(" "); } fsb.append("" + targetId); } return fsb.toString(); }
public String listComponentReferences(Map<Component, Integer> componentIdMap) { FastStringBuffer fsb = new FastStringBuffer(128); for (ComponentBinding ref : getComponentBindings()) { Component target = ref.getTarget(); int targetId = obtainComponentId(target, componentIdMap); if (fsb.length() != 0) { fsb.append(" "); } fsb.append("" + targetId); } return fsb.toString(); }
@Override public CharSequence evaluateAsString(XPathContext context) throws XPathException { FastStringBuffer buffer = new FastStringBuffer(256); for (Operand o: operands()) { Item it = o.getChildExpression().evaluateItem(context); if (it != null) { buffer.append(it.getStringValueCS()); } } return buffer; }