Add any attributes to the text.
167063
protected void addAttributes (AttributedString text)
    {
        // add any color attributes for specific segments
        if (_rawText != null) {
            Matcher m = COLOR_PATTERN.matcher(_rawText);
            int startSeg = 0, endSeg = 0;
            Color lastColor = null;
            while (m.find()) {
                // color the segment just passed
                endSeg += m.start();
                if (lastColor != null) {
                    text.addAttribute(TextAttribute.FOREGROUND, lastColor, startSeg, endSeg);
                }

                // parse the tag: start or end a color
                String group = m.group(1);
                if ("x".equalsIgnoreCase(group)) {
                    lastColor = null;
                } else {
                    lastColor = new Color(Integer.parseInt(group, 16));
                }

                // prepare for the next segment
                startSeg = endSeg;
                // Subtract the end of the segment from endSeg so that when we add the start of the
                // next match we have actually added the length of the characters in between.
                endSeg -= m.end();
            }
            // apply any final color to the tail segment
            if (lastColor != null) {
                text.addAttribute(TextAttribute.FOREGROUND, lastColor, startSeg, _text.length());
            }
        }
    }
415409
public void addAttributes(Iterable<? extends QName> attributes) {
        Level current = path.getLast();
        for (QName attribute : attributes) {
            current.attributes.put(attribute,
                                   new Level(ATTR + getName(attribute)));
        }
    }
407343
def set_attributes(d, elm):
    """"""
    for key in d:
        elm.setAttribute(key, d[key])
913920
def add_text(self, text):
        
        for char in text:
            self.add_char(char)
        self.flush()
897424
def text(self, value):
        """"""
        if value in (None, '') or value.strip() == "":
            raise AttributeError("Empty text value is invalid.")
        self._text = value
1287523
def add_on_empty(attributes, options = {})
      [attributes].flatten.each do |attribute|
        value = @base.send(:read_attribute_for_validation, attribute)
        is_empty = value.respond_to?(:empty?) ? value.empty? : false
        add(attribute, :empty, options) if value.nil? || is_empty
      end
    end
1040972
def add_current_text_if_valid(self):
        """"""
        valid = self.is_valid(self.currentText())
        if valid or valid is None:
            self.add_current_text()
            return True
        else:
            self.set_current_text(self.selected_text)
1216426
def add(self, text):
        
        if self._is_stringable(text) or self._is_qstring(text):
            self.text.append(PlainText(text))
        elif isinstance(text, Text):
            self.text.append(text)
        elif text is None or (hasattr(text, 'isNull') and text.isNull()):
            self.text.append(PlainText(
                tr('None or Null found from the data.')))
        else:
            raise InvalidMessageItemError(text, text.__class__)
506528
private static void addAttributes(String data, Map<String, ArrayList<String>> attribs) {
        String key;
        String value;
        int keyIndex = 0;
        int dataLen = data.length();
        for (keyIndex = 0; keyIndex < dataLen; keyIndex++) {
            if ((data.charAt(keyIndex) == USER_ATTRIB_DELIM) && (data.charAt(keyIndex - 1) != '\\')) {
                key = data.substring(0, keyIndex);
                value = data.substring(keyIndex + 1, dataLen);
                ArrayList<String> list = convertStringToArrayList(value);
                if (list != null) {
                    attribs.put(key, list);
                }
            }
        }
    }
37646
protected void addAttributes(Entity entity, Map<String, Object> attributes) {
        if (attributes != null) {
            for (Entry<String, Object> pairs : attributes.entrySet()) {
                entity.set(pairs.getKey(), pairs.getValue());
            }
        }
    }
356079
private void addCandidate(Text attribute) {
		// Copy and trim the attribute
		Text attr = new Text();
		attribute.copy(attr);
		attr.trim();
		
		// Parse the candidate field and add it to list of candidates
		CandidateField candidateField = new CandidateField(attr);
		this.candidates.add(candidateField);
		// Candidates must be listed by weight in descending order
		Collections.sort(this.candidates, Collections.reverseOrder());
	}
884285
def update_attributes(self, **original_kwargs):
        
        def update_attrs(layout_object):
            kwargs = original_kwargs.copy()
            if hasattr(layout_object, 'attrs'):
                if 'css_class' in kwargs:
                    if 'class' in layout_object.attrs:
                        layout_object.attrs['class'] += " %s" % kwargs.pop('css_class')
                    else:
                        layout_object.attrs['class'] = kwargs.pop('css_class')
                layout_object.attrs.update(kwargs)

        self.map(update_attrs)
553834
private void addDescriptionNodelets() {
        parser.setXpath("/aspectran/description");
        parser.addNodelet(attrs -> {
            String style = attrs.get("style");
            parser.pushObject(style);
        });
        parser.addNodeEndlet(text -> {
            String style = parser.popObject();
            if (style != null) {
                text = TextStyler.styling(text, style);
            }
            if (StringUtils.hasText(text)) {
                assistant.getAssistantLocal().setDescription(text);
            }
        });
    }
1323741
def do_attr_any(self, element, decl, pseudo):
        """"""
        step = self.state[self.state['current_step']]
        actions = step['actions']
        strval = self.eval_string_value(element, decl.value)
        actions.append(('attrib', (decl.name[5:], strval)))
846540
def add_attribute(self, attribute):
        
        self.attributes.append(attribute)
        return len(self.attributes)
1316116
def add_attribute_to_current_span(self, attribute_key, attribute_value):
        
        current_span = self.current_span()
        current_span.add_attribute(attribute_key, attribute_value)
1257046
def add_attrs(self, *args, _order=[], **kwargs):
        
        for arg in args:
            if isinstance(arg, (tuple, list)):
                key, color = arg
                self.attrs[key] = (None, color)
            else:
                self.attrs[arg] = (None, None)
        if not _order:
            for key, value in kwargs.items():
                self.attrs[key] = (value, None)
        else:
            for key in _order:
                self.attrs[key] = (kwargs[key], None)