FileDocCategorySizeDatePackage
FlowList.javaAPI DocJava SE 5 API3007Fri Aug 26 14:55:34 BST 2005com.sun.org.apache.xalan.internal.xsltc.compiler

FlowList

public final class FlowList extends Object
author
Jacek Ambroziak
author
Santiago Pericas-Geertsen

Fields Summary
private Vector
_elements
Constructors Summary
public FlowList()

	_elements = null;
    
public FlowList(InstructionHandle bh)

	_elements = new Vector();
	_elements.addElement(bh);
    
public FlowList(FlowList list)

	_elements = list._elements;
    
Methods Summary
public com.sun.org.apache.xalan.internal.xsltc.compiler.FlowListadd(com.sun.org.apache.bcel.internal.generic.InstructionHandle bh)

	if (_elements == null) {
	    _elements = new Vector();
	}
	_elements.addElement(bh);
	return this;
    
public com.sun.org.apache.xalan.internal.xsltc.compiler.FlowListappend(com.sun.org.apache.xalan.internal.xsltc.compiler.FlowList right)

	if (_elements == null) {
	    _elements = right._elements;
	}
	else {
	    final Vector temp = right._elements;
	    if (temp != null) {
		final int n = temp.size();
		for (int i = 0; i < n; i++) {
		    _elements.addElement(temp.elementAt(i));
		}
	    }
	}
	return this;
    
public voidbackPatch(com.sun.org.apache.bcel.internal.generic.InstructionHandle target)
Back patch a flow list. All instruction handles must be branch handles.

	if (_elements != null) {
	    final int n = _elements.size();
	    for (int i = 0; i < n; i++) {
		BranchHandle bh = (BranchHandle)_elements.elementAt(i);
		bh.setTarget(target);
	    }
	    _elements.clear();		// avoid backpatching more than once
	}
    
public com.sun.org.apache.xalan.internal.xsltc.compiler.FlowListcopyAndRedirect(com.sun.org.apache.bcel.internal.generic.InstructionList oldList, com.sun.org.apache.bcel.internal.generic.InstructionList newList)
Redirect the handles from oldList to newList. "This" flow list is assumed to be relative to oldList.

	final FlowList result = new FlowList();
	if (_elements == null) {
	    return result;
	}

	final int n = _elements.size();
	final Iterator oldIter = oldList.iterator();
	final Iterator newIter = newList.iterator();
	
	while (oldIter.hasNext()) {
	    final InstructionHandle oldIh = (InstructionHandle) oldIter.next();
	    final InstructionHandle newIh = (InstructionHandle) newIter.next();

	    for (int i = 0; i < n; i++) {
		if (_elements.elementAt(i) == oldIh) {
		    result.add(newIh);
		}
	    }
	}
	return result;