Writes a {@link AxisAlignedBB} to a {@link NBTTagCompound} with the specified prefix.

@param tag the tag
@param aabb the aabb
@param prefix the prefix
339579
public static void writeToNBT(NBTTagCompound tag, AxisAlignedBB aabb, String prefix)
	{
		if (tag == null || aabb == null)
			return;

		prefix = prefix == null ? "" : prefix + ".";
		tag.setDouble(prefix + "minX", aabb.minX);
		tag.setDouble(prefix + "minY", aabb.minY);
		tag.setDouble(prefix + "minZ", aabb.minZ);
		tag.setDouble(prefix + "maxX", aabb.maxX);
		tag.setDouble(prefix + "maxY", aabb.maxY);
		tag.setDouble(prefix + "maxZ", aabb.maxZ);
	}
1174331
public boolean isInside(AxisAlignedBB aabb)
	{
		return x >= aabb.minX && x <= aabb.maxX && y >= aabb.minY && y <= aabb.maxY && z >= aabb.minZ && z <= aabb.maxZ;
	}
536866
private static void appendTag(String tag, StringBuilder buffer) {
        if (buffer.length() != 0) {
            buffer.append(UNDERSCORE);
        }

        buffer.append(tag);
    }
1029742
public MetadataBuilder addTags(String tag, String... tags)
    {
        if (!StringUtils.isBlank(tag))
            this.tags.add(tag.trim());

        if (tags != null)
        {
            for (String t : tags)
            {
                if (!StringUtils.isBlank(t))
                    this.tags.add(t.trim());
            }
        }

        return this;
    }
819600
protected static void beginTag(final PrintWriter writer, final String tagName, final boolean newline, final List<Attr> attributes, final int level, final String indent) throws IOException {
		beginTag(writer, tagName, newline, false, attributes, level, indent);
	}
585636
public static <T> TaggedValue<T> taggedValue(String tag, T rep) {
        return new TaggedValueImpl<T>(tag, rep);
    }
1307830
@SuppressWarnings("unchecked")
    public <T extends WebLocatorAbstractBuilder> T setTag(final String tag) {
        pathBuilder.setTag(tag);
        return (T) this;
    }
1239264
public static void writeOut(Tag tag, BytecodeContext bc, boolean doReuse, final FlowControlFinal fcf) throws TransformerException {
	final GeneratorAdapter adapter = bc.getAdapter();
	final TagLibTag tlt = tag.getTagLibTag();

	final ClassDefinition cd = tlt.getTagClassDefinition();
	final boolean fromBundle = cd.getName() != null;
	final Type currType;
	final Type currDoFinallyType;

	if (fromBundle) {
	    try {
		if (Reflector.isInstaneOf(cd.getClazz(), BodyTag.class)) currType = BODY_TAG;
		else currType = TAG;
		currDoFinallyType = TRY_CATCH_FINALLY_TAG;
	    }
	    catch (Exception e) {
		if (e instanceof TransformerException) throw (TransformerException) e;
		throw new TransformerException(e, tag.getStart());
	    }
	}
	else {
	    currDoFinallyType = currType = getTagType(tag);

	}

	final int currLocal = adapter.newLocal(currType);
	Label tagBegin = new Label();
	Label tagEnd = new Label();
	ExpressionUtil.visitLine(bc, tag.getStart());
	// TODO adapter.visitLocalVariable("tag", "L"+currType.getInternalName()+";", null, tagBegin,
	// tagEnd, currLocal);

	adapter.visitLabel(tagBegin);
	// tag=pc.use(String tagClassName,String tagBundleName, String tagBundleVersion, String fullname,int
	// attrType) throws PageException {
	adapter.loadArg(0);
	adapter.checkCast(Types.PAGE_CONTEXT_IMPL);
	adapter.push(cd.getClassName());
	// has bundle info/version
	if (fromBundle) {
	    // name
	    adapter.push(cd.getName());
	    // version
	    if (cd.getVersion() != null) adapter.push(cd.getVersionAsString());
	    else ASMConstants.NULL(adapter);
	}
	adapter.push(tlt.getFullName());
	adapter.push(tlt.getAttributeType());
	adapter.push((bc.getPageSource() == null ? "<memory>" : bc.getPageSource().getDisplayPath()) + ":" + ((tag.getStart() == null) ? 0 : tag.getStart().line));
	adapter.invokeVirtual(Types.PAGE_CONTEXT_IMPL, fromBundle ? USE6 : USE4);
	if (currType != TAG) adapter.checkCast(currType);
	adapter.storeLocal(currLocal);

	TryFinallyVisitor outerTcfv = new TryFinallyVisitor(new OnFinally() {
	    @Override
	    public void _writeOut(BytecodeContext bc) {
		adapter.loadArg(0);
		adapter.checkCast(Types.PAGE_CONTEXT_IMPL);
		adapter.loadLocal(currLocal);
		if (cd.getName() != null) {
		    adapter.push(cd.getName());
		    if (cd.getVersion() != null) adapter.push(cd.getVersionAsString());
		    else ASMConstants.NULL(adapter);
		}
		adapter.invokeVirtual(Types.PAGE_CONTEXT_IMPL, fromBundle ? RE_USE3 : RE_USE1);
	    }
	}, null);
	if (doReuse) outerTcfv.visitTryBegin(bc);

	// appendix
	if (tlt.hasAppendix()) {
	    adapter.loadLocal(currLocal);
	    adapter.push(tag.getAppendix());
	    if (fromBundle) // PageContextUtil.setAppendix(tag,appendix)
		ASMUtil.invoke(ASMUtil.STATIC, adapter, Types.TAG_UTIL, SET_APPENDIX2);
	    else // tag.setAppendix(appendix)
		ASMUtil.invoke(ASMUtil.VIRTUAL, adapter, currType, SET_APPENDIX1);
	}

	// hasBody
	boolean hasBody = tag.getBody() != null;
	if (tlt.isBodyFree() && tlt.hasBodyMethodExists()) {
	    adapter.loadLocal(currLocal);
	    adapter.push(hasBody);

	    if (fromBundle) // PageContextUtil.setAppendix(tag,appendix)
		ASMUtil.invoke(ASMUtil.STATIC, adapter, Types.TAG_UTIL, HAS_BODY2);
	    else // tag.setAppendix(appendix)
		ASMUtil.invoke(ASMUtil.VIRTUAL, adapter, currType, HAS_BODY1);
	}

	// default attributes (get overwritten by attributeCollection because of that set before)
	setAttributes(bc, tag, currLocal, currType, true, fromBundle);

	// attributeCollection
	Attribute attrColl = tag.getAttribute("attributecollection");
	if (attrColl != null) {
	    int attrType = tag.getTagLibTag().getAttributeType();
	    if (TagLibTag.ATTRIBUTE_TYPE_NONAME != attrType) {
		tag.removeAttribute("attributecollection");
		// TagUtil.setAttributeCollection(Tag, Struct)
		adapter.loadArg(0);
		adapter.loadLocal(currLocal);
		if (currType != TAG) adapter.cast(currType, TAG);

		///
		TagLibTagAttr[] missings = tag.getMissingAttributes();
		if (!ArrayUtil.isEmpty(missings)) {
		    ArrayVisitor av = new ArrayVisitor();
		    av.visitBegin(adapter, MISSING_ATTRIBUTE, missings.length);
		    int count = 0;
		    TagLibTagAttr miss;
		    for (int i = 0; i < missings.length; i++) {
			miss = missings[i];
			av.visitBeginItem(adapter, count++);
			bc.getFactory().registerKey(bc, bc.getFactory().createLitString(miss.getName()), false);
			adapter.push(miss.getType());
			if (ArrayUtil.isEmpty(miss.getAlias())) adapter.invokeStatic(MISSING_ATTRIBUTE, NEW_INSTANCE_MAX2);
			else {
			    new LiteralStringArray(bc.getFactory(), miss.getAlias()).writeOut(bc, Expression.MODE_REF);
			    adapter.invokeStatic(MISSING_ATTRIBUTE, NEW_INSTANCE_MAX3);
			}
			av.visitEndItem(bc.getAdapter());
		    }
		    av.visitEnd();
		}
		else {
		    ASMConstants.NULL(adapter);
		}
		///
		attrColl.getValue().writeOut(bc, Expression.MODE_REF);

		adapter.push(attrType);
		adapter.invokeStatic(TAG_UTIL, SET_ATTRIBUTE_COLLECTION);
	    }
	}

	// metadata
	Attribute attr;
	Map<String, Attribute> metadata = tag.getMetaData();
	if (metadata != null) {
	    Iterator<Attribute> it = metadata.values().iterator();
	    while (it.hasNext()) {
		attr = it.next();
		adapter.loadLocal(currLocal);
		adapter.push(attr.getName());
		attr.getValue().writeOut(bc, Expression.MODE_REF);

		if (fromBundle) ASMUtil.invoke(ASMUtil.STATIC, adapter, Types.TAG_UTIL, SET_META_DATA3);
		else ASMUtil.invoke(ASMUtil.VIRTUAL, adapter, currType, SET_META_DATA2);
	    }
	}

	// set attributes
	setAttributes(bc, tag, currLocal, currType, false, fromBundle);
	// Body
	if (hasBody) {
	    final int state = adapter.newLocal(Types.INT_VALUE);

	    // int state=tag.doStartTag();
	    adapter.loadLocal(currLocal);
	    ASMUtil.invoke(fromBundle ? ASMUtil.INTERFACE : ASMUtil.VIRTUAL, adapter, currType, DO_START_TAG);
	    // adapter.invokeVirtual(currType, DO_START_TAG);
	    adapter.storeLocal(state);

	    // if (state!=Tag.SKIP_BODY)
	    Label endBody = new Label();
	    adapter.loadLocal(state);
	    adapter.push(javax.servlet.jsp.tagext.Tag.SKIP_BODY);
	    adapter.visitJumpInsn(Opcodes.IF_ICMPEQ, endBody);
	    // pc.initBody(tag, state);
	    adapter.loadArg(0);
	    adapter.loadLocal(currLocal);
	    adapter.loadLocal(state);
	    adapter.invokeVirtual(Types.PAGE_CONTEXT, INIT_BODY);

	    OnFinally onFinally = new OnFinally() {

		@Override
		public void _writeOut(BytecodeContext bc) {
		    Label endIf = new Label();
		    /*
		     * if(tlt.handleException() && fcf!=null && fcf.getAfterFinalGOTOLabel()!=null){
		     * ASMUtil.visitLabel(adapter, fcf.getFinalEntryLabel()); }
		     */
		    adapter.loadLocal(state);
		    adapter.push(javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE);
		    adapter.visitJumpInsn(Opcodes.IF_ICMPEQ, endIf);
		    // ... pc.popBody();
		    adapter.loadArg(0);
		    adapter.invokeVirtual(Types.PAGE_CONTEXT, POP_BODY);
		    adapter.pop();
		    adapter.visitLabel(endIf);

		    // tag.doFinally();
		    if (tlt.handleException()) {
			adapter.loadLocal(currLocal);
			ASMUtil.invoke(fromBundle ? ASMUtil.INTERFACE : ASMUtil.VIRTUAL, adapter, currDoFinallyType, DO_FINALLY);
			// adapter.invokeVirtual(currType, DO_FINALLY);
		    }
		    // GOTO after execution body, used when a continue/break was called before
		    /*
		     * if(fcf!=null) { Label l = fcf.getAfterFinalGOTOLabel();
		     * if(l!=null)adapter.visitJumpInsn(Opcodes.GOTO, l); }
		     */

		}
	    };

	    if (tlt.handleException()) {
		TryCatchFinallyVisitor tcfv = new TryCatchFinallyVisitor(onFinally, fcf);
		tcfv.visitTryBegin(bc);
		doTry(bc, adapter, tag, currLocal, currType, fromBundle);
		int t = tcfv.visitTryEndCatchBeging(bc);
		// tag.doCatch(t);
		adapter.loadLocal(currLocal);
		adapter.loadLocal(t);
		// adapter.visitVarInsn(Opcodes.ALOAD,t);
		ASMUtil.invoke(fromBundle ? ASMUtil.INTERFACE : ASMUtil.VIRTUAL, adapter, currDoFinallyType, DO_CATCH);
		// adapter.invokeVirtual(currType, DO_CATCH);
		tcfv.visitCatchEnd(bc);
	    }
	    else {
		TryFinallyVisitor tfv = new TryFinallyVisitor(onFinally, fcf);
		tfv.visitTryBegin(bc);
		doTry(bc, adapter, tag, currLocal, currType, fromBundle);
		tfv.visitTryEnd(bc);
	    }

	    adapter.visitLabel(endBody);

	}
	else {
	    // tag.doStartTag();
	    adapter.loadLocal(currLocal);
	    ASMUtil.invoke(fromBundle ? ASMUtil.INTERFACE : ASMUtil.VIRTUAL, adapter, currType, DO_START_TAG);
	    // adapter.invokeVirtual(currType, DO_START_TAG);
	    adapter.pop();
	}

	// if (tag.doEndTag()==Tag.SKIP_PAGE) throw new Abort(0<!-- SCOPE_PAGE -->);
	Label endDoEndTag = new Label();
	adapter.loadLocal(currLocal);
	ASMUtil.invoke(fromBundle ? ASMUtil.INTERFACE : ASMUtil.VIRTUAL, adapter, currType, DO_END_TAG);
	// adapter.invokeVirtual(currType, DO_END_TAG);
	adapter.push(javax.servlet.jsp.tagext.Tag.SKIP_PAGE);
	adapter.visitJumpInsn(Opcodes.IF_ICMPNE, endDoEndTag);
	adapter.push(Abort.SCOPE_PAGE);
	adapter.invokeStatic(ABORT, NEW_INSTANCE);
	adapter.throwException();
	adapter.visitLabel(endDoEndTag);

	if (doReuse) {
	    // } finally{pc.reuse(tag);}
	    outerTcfv.visitTryEnd(bc);
	}

	adapter.visitLabel(tagEnd);
	ExpressionUtil.visitLine(bc, tag.getEnd());
    }
1346487
boolean checkTag(long bucketIndex, int posInBucket, long tag) {
		long tagStartIdx = getTagOffset(bucketIndex, posInBucket);
		final int bityPerTag = bitsPerTag;
		for (long i = 0; i < bityPerTag; i++) {
			if (memBlock.get(i + tagStartIdx) != ((tag & (1L << i)) != 0))
				return false;
		}
		return true;
	}
546545
private void addFacetNameToParentTag(UIComponentClassicTagBase parentTag, String facetName)
    {
        if (parentTag._facetsAdded == null)
        {
            parentTag._facetsAdded = new ArrayList<String>();
        }
        parentTag._facetsAdded.add(facetName);
    }
341611
public static AxisAlignedBB rotate(AxisAlignedBB aabb, EnumFacing dir)
	{
		if (dir == EnumFacing.SOUTH)
			return aabb;

		int angle = dir.getAxis() == Axis.Y ? dir.getAxisDirection().getOffset() : EnumFacingUtils.getRotationCount(dir);
		Axis axis = dir.getAxis() == Axis.Y ? Axis.X : Axis.Y;

		return rotate(aabb, angle, axis);
	}
268758
public boolean addPreserveTag(final String tagName) {

        Vector<Attribute> attributeList = new Vector<Attribute>(1);
        Attribute tagNameAttribute = new Attribute();
        tagNameAttribute.setName(tagName.toLowerCase());
        attributeList.add(tagNameAttribute);
        Tag keepTag = m_nodeFactory.createTagNode(null, 0, 0, attributeList);
        boolean result = m_nodeFactory.addTagPreserve(keepTag);
        return result;
    }
663799
private void writeTag(String tag, String value) throws IOException {
    printIndents();
    if(value.length() > 0) {
      write("<" + tag + ">" + value + "</" + tag + ">\n");
    } else {
      write("<" + tag + "/>\n");
    }
  }
157311
public List<Pair<EnumFacing, Point>> intersect(AxisAlignedBB aabb)
	{
		double ix = intersectX(aabb.minX);
		double iX = intersectX(aabb.maxX);
		double iy = intersectY(aabb.minY);
		double iY = intersectY(aabb.maxY);
		double iz = intersectZ(aabb.minZ);
		double iZ = intersectZ(aabb.maxZ);
		Point interx = ix >= 0 ? getPointAt(ix) : null;
		Point interX = iX >= 0 ? getPointAt(iX) : null;
		Point intery = iy >= 0 ? getPointAt(iy) : null;
		Point interY = iY >= 0 ? getPointAt(iY) : null;
		Point interz = iz >= 0 ? getPointAt(iz) : null;
		Point interZ = iZ >= 0 ? getPointAt(iZ) : null;

		List<Pair<EnumFacing, Point>> list = new ArrayList<>();
		if (interx != null && interx.isInside(aabb))
			list.add(Pair.of(EnumFacing.WEST, interx));
		if (interX != null && interX.isInside(aabb))
			list.add(Pair.of(EnumFacing.EAST, interX));

		if (intery != null && intery.isInside(aabb))
			list.add(Pair.of(EnumFacing.DOWN, intery));
		if (interY != null && interY.isInside(aabb))
			list.add(Pair.of(EnumFacing.UP, interY));

		if (interz != null && interz.isInside(aabb))
			list.add(Pair.of(EnumFacing.NORTH, interz));
		if (interZ != null && interZ.isInside(aabb))
			list.add(Pair.of(EnumFacing.SOUTH, interZ));

		return list;
	}
489811
public static AxisAlignedBB rotate(AxisAlignedBB aabb, int angle, Axis axis)
	{
		if (aabb == null || angle == 0 || axis == null)
			return aabb;

		int a = -angle & 3;
		int s = sin[a];
		int c = cos[a];

		aabb = aabb.offset(-0.5F, -0.5F, -0.5F);

		double minX = aabb.minX;
		double minY = aabb.minY;
		double minZ = aabb.minZ;
		double maxX = aabb.maxX;
		double maxY = aabb.maxY;
		double maxZ = aabb.maxZ;

		if (axis == Axis.X)
		{
			minY = (aabb.minY * c) - (aabb.minZ * s);
			maxY = (aabb.maxY * c) - (aabb.maxZ * s);
			minZ = (aabb.minY * s) + (aabb.minZ * c);
			maxZ = (aabb.maxY * s) + (aabb.maxZ * c);

		}
		if (axis == Axis.Y)
		{
			minX = (aabb.minX * c) - (aabb.minZ * s);
			maxX = (aabb.maxX * c) - (aabb.maxZ * s);
			minZ = (aabb.minX * s) + (aabb.minZ * c);
			maxZ = (aabb.maxX * s) + (aabb.maxZ * c);
		}

		if (axis == Axis.Z)
		{
			minX = (aabb.minX * c) - (aabb.minY * s);
			maxX = (aabb.maxX * c) - (aabb.maxY * s);
			minY = (aabb.minX * s) + (aabb.minY * c);
			maxY = (aabb.maxX * s) + (aabb.maxY * c);
		}

		aabb = new AxisAlignedBB(minX + 0.5F, minY + 0.5F, minZ + 0.5F, maxX + 0.5F, maxY + 0.5F, maxZ + 0.5F);

		return aabb;
	}
666390
public static StringBuffer appendClosingTag(StringBuffer buffer, String tag)
	{
		StringBuffer _buffer = initStringBufferIfNecessary(buffer);
		return doAppendClosingTag(_buffer, tag);
	}
581542
public static AxisAlignedBB combine(AxisAlignedBB[] aabbs)
	{
		if (ArrayUtils.isEmpty(aabbs))
			return null;

		AxisAlignedBB ret = null;
		for (AxisAlignedBB aabb : aabbs)
		{
			if (ret == null)
				ret = aabb;
			else if (aabb != null)
				ret = ret.union(aabb);
		}

		return ret;
	}