if(ls.isEmpty()) result = BooleanValue.EMPTY_SEQUENCE; else { Sequence rs = getRight().eval(contextSequence, contextItem); if(rs.isEmpty()) { return BooleanValue.EMPTY_SEQUENCE; } else { NodeValue sv = (NodeValue)ls.itemAt(0); NodeValue rv = (NodeValue)rs.itemAt(0);  if(sv.getImplementationType() != rv.getImplementationType()) {  return BooleanValue.FALSE; }
Sequence rs = getRight().eval(contextSequence, contextItem); if(!ls.isEmpty() && !rs.isEmpty()) { NodeValue lv = (NodeValue)ls.itemAt(0); NodeValue rv = (NodeValue)rs.itemAt(0); if(lv.getImplementationType() != rv.getImplementationType()) {  result =  BooleanValue.FALSE; } else {
	public Sequence eval(Sequence contextSequence, Item contextItem) 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);            if (contextItem != null)                context.getProfiler().message(this, Profiler.START_SEQUENCES, "CONTEXT ITEM", contextItem.toSequence());        }        		if(contextItem != null)			contextSequence = contextItem.toSequence();        		Sequence result;		Sequence ls = getLeft().eval(contextSequence, contextItem);        if(ls.isEmpty())            result = BooleanValue.EMPTY_SEQUENCE;        else {	        Sequence rs = getRight().eval(contextSequence, contextItem);					if(rs.isEmpty()) {				return BooleanValue.EMPTY_SEQUENCE;	        } else {						NodeValue sv = (NodeValue)ls.itemAt(0);				NodeValue rv = (NodeValue)rs.itemAt(0);		        				if(sv.getImplementationType() != rv.getImplementationType()) {					// different implementations					return BooleanValue.FALSE;				}								switch(relation) {					case Constants.IS:						result = sv.equals(rv) ? BooleanValue.TRUE : BooleanValue.FALSE;						break;					case Constants.ISNOT:						result = sv.equals(rv) ? BooleanValue.FALSE : BooleanValue.TRUE;						break;					case Constants.BEFORE:						result = sv.before(rv) ? BooleanValue.TRUE : BooleanValue.FALSE;						break;					case Constants.AFTER:						result = sv.after(rv) ? BooleanValue.TRUE : BooleanValue.FALSE;						break;					default:						throw new XPathException("Illegal argument: unknown relation");				}	        }        }                if (context.getProfiler().isEnabled())             context.getProfiler().end(this, "", result);        		return result;	}