switch (axis) { case Constants.DESCENDANT_AXIS : case Constants.DESCENDANT_SELF_AXIS : temp = getDescendants( context, contextSequence.toNodeSet()); break; case Constants.CHILD_AXIS : temp = getChildren(context, contextSequence.toNodeSet()); break; case Constants.ANCESTOR_SELF_AXIS :   int testType = test.getType(); if (testType != Type.NODE && testType != Type.ELEMENT )	{  temp = NodeSet.EMPTY_SET; break; } case Constants.ANCESTOR_AXIS : temp = getAncestors(context, contextSequence.toNodeSet()); break; case Constants.SELF_AXIS : temp = getSelf(context, contextSequence.toNodeSet()); break; case Constants.PARENT_AXIS : temp = getParents(context, contextSequence.toNodeSet()); break; case Constants.ATTRIBUTE_AXIS :  case Constants.DESCENDANT_ATTRIBUTE_AXIS : temp = getAttributes( context, contextSequence.toNodeSet()); break; case Constants.PRECEDING_SIBLING_AXIS : case Constants.FOLLOWING_SIBLING_AXIS : temp = getSiblings(context, contextSequence.toNodeSet()); break; case Constants.FOLLOWING_AXIS: temp = getFollowing(context, contextSequence.toNodeSet()); break; case Constants.PRECEDING_AXIS: temp = getPreceding(context, contextSequence.toNodeSet()); break; default : throw new IllegalArgumentException("Unsupported axis specified"); }  if(contextSequence instanceof NodeSet) { cached = new CachedResult((NodeSet)contextSequence, temp); registerUpdateListener(); }  temp.removeDuplicates(); temp = (predicates.size() == 0) ? temp : applyPredicate(contextSequence, temp);
	public Sequence eval(		Sequence contextSequence,		Item contextItem)		throws XPathException {		if (contextItem != null)			contextSequence = contextItem.toSequence();		if(contextSequence == null)			return NodeSet.EMPTY_SET;                if ( context.isProfilingEnabled() && context.getProfiler().verbosity() > 1) {            context.getProfiler().start(this, Constants.AXISSPECIFIERS[axis] + "::" + test);        }        		if(cached != null &&			cached.isValid(contextSequence)) {            if ( context.isProfilingEnabled() && context.getProfiler().verbosity() > 1) {                context.getProfiler().end(this, "Returning cached result. Length: " + cached.getResult().getLength());            }			return 			(predicates.size() == 0)			? cached.getResult() :				applyPredicate(contextSequence, cached.getResult());		}		Sequence temp;		switch (axis) {			case Constants.DESCENDANT_AXIS :			case Constants.DESCENDANT_SELF_AXIS :				temp =					getDescendants(						context,						contextSequence.toNodeSet());				break;			case Constants.CHILD_AXIS :				temp =					getChildren(context, contextSequence.toNodeSet());				break;						case Constants.ANCESTOR_SELF_AXIS :								//Avoid unnecessary tests//				TODO : log this costly operation into the profiler ?							int testType = test.getType();				if (testType != Type.NODE && testType != Type.ELEMENT )	{//					TODO : log this shortcut into the profiler ?										temp = NodeSet.EMPTY_SET;					break;				}			case Constants.ANCESTOR_AXIS :				temp =					getAncestors(context, contextSequence.toNodeSet());				break;			case Constants.SELF_AXIS :				temp = getSelf(context, contextSequence.toNodeSet());				break;			case Constants.PARENT_AXIS :				temp =					getParents(context, contextSequence.toNodeSet());				break;			case Constants.ATTRIBUTE_AXIS :				// combines /descendant-or-self::node()/attribute:*			case Constants.DESCENDANT_ATTRIBUTE_AXIS :				temp =					getAttributes(						context,						contextSequence.toNodeSet());				break;			case Constants.PRECEDING_SIBLING_AXIS :			case Constants.FOLLOWING_SIBLING_AXIS :				temp =					getSiblings(context, contextSequence.toNodeSet());				break;			case Constants.FOLLOWING_AXIS:				temp = getFollowing(context, contextSequence.toNodeSet());                break;			case Constants.PRECEDING_AXIS:                temp = getPreceding(context, contextSequence.toNodeSet());                break;			default :				throw new IllegalArgumentException("Unsupported axis specified");		}				if(contextSequence instanceof NodeSet) {			cached = new CachedResult((NodeSet)contextSequence, temp);			registerUpdateListener();		}		// remove duplicate nodes		temp.removeDuplicates();		temp =			(predicates.size() == 0)				? temp				: applyPredicate(contextSequence, temp);        if ( context.isProfilingEnabled() && context.getProfiler().verbosity() > 1) {            context.getProfiler().end(this, " LocationStep" +                     ", " + Constants.AXISSPECIFIERS[axis] +                    "::" + test + ", found: " + temp.getLength()            );        }        return temp;	}