Returns true if the given Tag contains attributes that are not
specified in standardAttributesSorted.
NOTE that standardAttributesSorted has to be alphabetically sorted in
order to use binary search.
@param tag
@param standardAttributesSorted
@return
357486
public static boolean containsUnspecifiedAttributes(Tag tag, String[] standardAttributesSorted)
    {
        for (TagAttribute attribute : tag.getAttributes().getAll())
        {
            final String name = attribute.getLocalName();
            if (Arrays.binarySearch(standardAttributesSorted, name) < 0)
            {
                return true;
            }
        }
        return false;
    }
468815
public static boolean inAttributes(String attrName, Attributes attrs) {
        for (NamingEnumeration<String> neu = attrs.getIDs(); neu.hasMoreElements();) {
            String attrId = neu.nextElement();
            if (attrId.equalsIgnoreCase(attrName)) {
                return true;
            }
        }
        return false;
    }
679284
private boolean hasAnyTypeRelatedTags() {
    return currentInfo.isConstructor()
        || currentInfo.isInterface()
        || currentInfo.isAbstract()
        || currentInfo.getParameterCount() > 0
        || currentInfo.hasReturnType()
        || currentInfo.hasBaseType()
        || currentInfo.getExtendedInterfacesCount() > 0
        || currentInfo.hasLendsName()
        || currentInfo.hasThisType()
        || hasAnySingletonTypeTags();
  }
827852
public static IStandardExpression computeAttributeExpression(
            final ITemplateContext context, final IProcessableElementTag tag, final AttributeName attributeName, final String attributeValue) {

        if (!(tag instanceof AbstractProcessableElementTag)) {
            return parseAttributeExpression(context, attributeValue);
        }

        final AbstractProcessableElementTag processableElementTag = (AbstractProcessableElementTag)tag;
        final Attribute attribute = (Attribute) processableElementTag.getAttribute(attributeName);

        IStandardExpression expression = attribute.getCachedStandardExpression();
        if (expression != null) {
            return expression;
        }

        expression = parseAttributeExpression(context, attributeValue);
        // If the expression has been correctly parsed AND it does not contain preprocessing marks (_), nor it is a FragmentExpression, cache it!
        if (expression != null && !(expression instanceof FragmentExpression) && attributeValue.indexOf('_') < 0) {
            attribute.setCachedStandardExpression(expression);
        }

        return expression;

    }
1336500
public static Boolean getAttributeBoolean(Tag tag, String attrName) throws EvaluatorException {
	Boolean b = getAttributeLiteral(tag, attrName).getBoolean(null);
	if (b == null) throw new EvaluatorException("attribute [" + attrName + "] must be a constant boolean value");
	return b;
    }
209309
@Override
    public int compareTo(Tag tag) {
        int keyResult = this.key.compareTo(tag.key);

        if (keyResult != 0) {
            return keyResult;
        }

        return this.value.compareTo(tag.value);
    }
503684
public function hasTag($tag)
    {
        if ($this->isTopTag($tag)) {
            return true;
        }

        return isset($this->tags[$tag]) && is_array($this->tags[$tag]);
    }
252973
def _in_tag(self, tagname, attributes=None):
        
        node = self.cur_node
        while not node is None:
            if node.tag == tagname:
                if attributes and node.attrib == attributes:
                    return True

                elif attributes:
                    return False

                return True

            node = node.getparent()
        return False
88763
public void writeTag(Tag<?> tag) throws IOException {
        String name = tag.getName();
        byte[] nameBytes = name.getBytes(NBTConstants.CHARSET.name());

        os.writeByte(tag.getType().getId());
        os.writeShort(nameBytes.length);
        os.write(nameBytes);

        if (tag.getType() == TagType.TAG_END) {
            throw new IOException("Named TAG_End not permitted.");
        }

        writeTagPayload(tag);
    }
424830
public boolean matches(final Node node) throws IllegalArgumentException {
        // Precondition checks
        if (node == null) {
            throw new IllegalArgumentException("node must be specified");
        }

        if (!name.equals(node.getName())) {
            return false;
        }

        if ((text != null && node.getText() == null) || (text != null && !text.trim().equals(node.getText().trim()))) {
            return false;
        }

        if (attributes != null) {
            for (final Map.Entry<String, String> attribute : attributes.entrySet()) {
                final String attrValue = attribute.getValue();
                final String attrName = attribute.getKey();

                if (!attrValue.equals(node.getAttribute(attrName))) {
                    return false;
                }
            }
        }

        return true;
    }
116983
public static boolean hasSisterTagAfter(Tag tag, String nameToFind) {
	Body body = (Body) tag.getParent();
	List<Statement> stats = body.getStatements();
	Iterator<Statement> it = stats.iterator();
	Statement other;

	boolean isAfter = false;
	while (it.hasNext()) {
	    other = it.next();

	    if (other instanceof Tag) {
		if (isAfter) {
		    if (((Tag) other).getTagLibTag().getName().equals(nameToFind)) return true;
		}
		else if (other == tag) isAfter = true;
	    }
	}
	return false;
    }
150893
public boolean hasOneTag(Tag... tags) {
        for(Tag t : tags) {
            if (this.tags.contains(t)) return true;
        }
        return false;
    }
1240444
public <T extends Tag> T put(T tag) {
        return (T) this.value.put(tag.getName(), tag);
    }
371289
private void writeTagPayload(Tag<?> tag) throws IOException {
        switch (tag.getType()) {
            case TAG_END:
                writeEndTagPayload((EndTag) tag);
                break;

            case TAG_BYTE:
                writeByteTagPayload((ByteTag) tag);
                break;

            case TAG_SHORT:
                writeShortTagPayload((ShortTag) tag);
                break;

            case TAG_INT:
                writeIntTagPayload((IntTag) tag);
                break;

            case TAG_LONG:
                writeLongTagPayload((LongTag) tag);
                break;

            case TAG_FLOAT:
                writeFloatTagPayload((FloatTag) tag);
                break;

            case TAG_DOUBLE:
                writeDoubleTagPayload((DoubleTag) tag);
                break;

            case TAG_BYTE_ARRAY:
                writeByteArrayTagPayload((ByteArrayTag) tag);
                break;

            case TAG_STRING:
                writeStringTagPayload((StringTag) tag);
                break;

            case TAG_LIST:
                writeListTagPayload((ListTag<?>) tag);
                break;

            case TAG_COMPOUND:
                writeCompoundTagPayload((CompoundTag) tag);
                break;

            case TAG_INT_ARRAY:
                writeIntArrayTagPayload((IntArrayTag) tag);
                break;

            case TAG_SHORT_ARRAY:
                writeShortArrayTagPayload((ShortArrayTag) tag);
                break;

            default:
                throw new IOException("Invalid tag type: " + tag.getType() + ".");
        }
    }
253712
public function hasTag(Tag $tag)
    {
        foreach ($this->_tags as $knownTag) {
            if ($knownTag->getId() == $tag->getId()) {
                return true;
            }
        }

        return false;
    }
341714
public boolean acceptTaggedScenario(final Set<String> tags) {

        if (acceptAll || (acceptedTags.isEmpty() && excludedTags.isEmpty())) {
            return true;
        } else if (acceptedTags.size() > 0 && (tags == null || tags.isEmpty())) {
            return false;
        } else if (containsAny(tags, excludedTags)) {
            return false;
        } else {
            return tags == null || tags.containsAll(acceptedTags);
        }
    }
127090
public void removeTaggedComponent(final String tag) {
		TemplateModel model = getOrCreateComponentModel();
		if (model.taggedComponents != null) {
			WComponent component = model.taggedComponents.remove(tag);
			if (model.taggedComponents.isEmpty()) {
				model.taggedComponents = null;
			}
			if (component != null) {
				remove(component);
			}
		}
	}