if (executionMode == BOOLEAN && !innerExpressionDot && !Dependency.dependsOn(inner, Dependency.CONTEXT_ITEM)) { Sequence innerSeq = inner.eval(contextSequence);  if (innerSeq.hasOne() && Type.subTypeOf(innerSeq.getItemType(), Type.NUMBER)) { recomputedExecutionMode = POSITIONAL; } }
	public Sequence evalPredicate(Sequence outerSequence, Sequence contextSequence,	int mode)		    throws XPathException {        if (context.getProfiler().isEnabled()) {            context.getProfiler().start(this);            context.getProfiler().message(this, Profiler.DEPENDENCIES, "DEPENDENCIES", Dependency.getDependenciesName(this.getDependencies()));            if (contextSequence != null)                context.getProfiler().message(this, Profiler.START_SEQUENCES, "CONTEXT SEQUENCE", contextSequence);        }                            Sequence result;		Expression inner = getExpression(0);		if (inner == null)			result = Sequence.EMPTY_SEQUENCE;        else {            int recomputedExecutionMode = executionMode;                         //Try to promote a boolean evaluation to a positionnal one              if (executionMode == BOOLEAN) {            	//Atomic sequences will keep evaluating "." in BOOLEAN mode            	if (!innerExpressionDot && !Type.subTypeOf(contextSequence.getItemType(), Type.NODE)) {              		Sequence innerSeq = inner.eval(contextSequence); 	                //Only if we have an actual *singleton* of numeric items	                if (innerSeq.hasOne() && Type.subTypeOf(innerSeq.getItemType(), Type.NUMBER)) { 	                    recomputedExecutionMode = POSITIONAL;	            	}            	}            }                          if (executionMode == NODE && Type.subTypeOf(contextSequence.getItemType(), Type.ATOMIC)                    && !(contextSequence instanceof VirtualNodeSet)) {                recomputedExecutionMode = BOOLEAN;            }            //(1,2,3)[xs:decimal(.)]            //TODO : think and find *the* triggering condition that leads to boolean evaluation            //ideally determine it at analysis time            if (executionMode == POSITIONAL && innerExpressionDot &&             		Type.subTypeOf(contextSequence.getItemType(), Type.ATOMIC)) {                recomputedExecutionMode = BOOLEAN;            }                		switch(recomputedExecutionMode) {    			case NODE:                     if (context.getProfiler().isEnabled())                        context.getProfiler().message(this, Profiler.OPTIMIZATION_FLAGS,                                 "OPTIMIZATION CHOICE", "Node selection");                                        result = selectByNodeSet(contextSequence);                                        break;                case BOOLEAN:                     if (context.getProfiler().isEnabled())                        context.getProfiler().message(this, Profiler.OPTIMIZATION_FLAGS,                                 "OPTIMIZATION CHOICE", "Boolean evaluation");                                        result = evalBoolean(contextSequence, inner);                    break;    			case POSITIONAL:                     if (context.getProfiler().isEnabled())                        context.getProfiler().message(this, Profiler.OPTIMIZATION_FLAGS,                                 "OPTIMIZATION CHOICE", "Positional evaluation");                                        result = selectByPosition(outerSequence, contextSequence, mode, inner);                    break;    			default:                    throw new IllegalArgumentException("Unsupported execution mode: '" + recomputedExecutionMode + "'");			        		}                    }                if (context.getProfiler().isEnabled())             context.getProfiler().end(this, "", result);                return result;	}