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

AlternativePattern

public final class AlternativePattern extends Pattern
author
Jacek Ambroziak
author
Santiago Pericas-Geertsen

Fields Summary
private final Pattern
_left
private final Pattern
_right
Constructors Summary
public AlternativePattern(Pattern left, Pattern right)
Construct an alternative pattern. The method setParent should not be called in this case.

	_left = left;
	_right = right;
    
Methods Summary
public com.sun.org.apache.xalan.internal.xsltc.compiler.PatterngetLeft()

	return _left;
    
public doublegetPriority()

	double left = _left.getPriority();
	double right = _right.getPriority();
	
	if (left < right)
	    return(left);
	else
	    return(right);
    
public com.sun.org.apache.xalan.internal.xsltc.compiler.PatterngetRight()

	return _right;
    
public voidsetParser(com.sun.org.apache.xalan.internal.xsltc.compiler.Parser parser)

	super.setParser(parser);
	_left.setParser(parser);
	_right.setParser(parser);
    
public java.lang.StringtoString()

	return "alternative(" + _left + ", " + _right + ')";
    
public voidtranslate(com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator classGen, com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator methodGen)

	final InstructionList il = methodGen.getInstructionList();

	_left.translate(classGen, methodGen);
	final InstructionHandle gotot = il.append(new GOTO(null));
	il.append(methodGen.loadContextNode());
	_right.translate(classGen, methodGen);

	_left._trueList.backPatch(gotot);
	_left._falseList.backPatch(gotot.getNext());

	_trueList.append(_right._trueList.add(gotot));
	_falseList.append(_right._falseList);
    
public com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypetypeCheck(com.sun.org.apache.xalan.internal.xsltc.compiler.SymbolTable stable)
The type of an '|' is not really defined, hence null is returned.

	_left.typeCheck(stable);
	_right.typeCheck(stable);
	return null;