1 61 62 63 package org.jaxen.function; 64 65 import java.util.List ; 66 67 import org.jaxen.Context; 68 import org.jaxen.Function; 69 import org.jaxen.FunctionCallException; 70 71 82 public class PositionFunction implements Function 83 { 84 85 88 public PositionFunction() {} 89 90 103 public Object call(Context context, List args) throws FunctionCallException 104 { 105 if ( args.size() == 0 ) 106 { 107 return evaluate( context ); 108 } 109 110 throw new FunctionCallException( "position() requires no arguments." ); 111 } 112 113 124 public static Double evaluate(Context context) 125 { 126 return new Double ( context.getPosition() ); 127 } 128 129 } 130 | Popular Tags |