public int getArgCount() { return NAME.getArgumentCount(); }
public int getArgCount() { return NAME.getArgumentCount(); }
public int getArgCount() { return NAME.getArgumentCount(); }
/** Sets the function parameters. */ public void setParameters(List<Expression> params) { if (params == null) { throw new NullPointerException("Function parameters required"); } final int argCount = functionName.getArgumentCount(); final int paramsSize = params.size(); if (argCount > 0 && argCount != paramsSize) { throw new IllegalArgumentException( "Function " + name + " expected " + argCount + " arguments, got " + paramsSize); } this.params = new ArrayList<Expression>(params); }
public Element encode(Object object, Document document, Element value) throws Exception { FunctionName function = (FunctionName) object; value.appendChild(document.createTextNode(function.getName())); value.setAttributeNS("", "nArgs", function.getArgumentCount() + ""); return value; } }
/** * {@inheritDoc} This method is overriden to allow for either a single parameter (variable name) * or two parameters (variable name plus default value). */ @Override public void setParameters(List params) { if (params == null) { throw new NullPointerException("params can't be null"); } final int argCount = NAME.getArgumentCount(); final int paramsSize = params.size(); if (paramsSize < argCount || paramsSize > argCount + 1) { throw new IllegalArgumentException( String.format( "Function %s expected %d or %d arguments but got %d", name, argCount, argCount + 1, paramsSize)); } this.params = new ArrayList(params); }
public synchronized FunctionName getFunctionName() { if (functionName == null) { functionName = new FunctionNameImpl(getName(), functionName.getArgumentCount()); } return functionName; }
public void testGetArgCount() { final List expected = Collections.singletonList(new LiteralExpressionImpl(10d)); function.setParameters(expected); assertEquals(1, function.getFunctionName().getArgumentCount()); }
/** Test of getArgCount method, of class FilterFunction_minimumDiameter. */ @Test public void testGetArgCount() { FilterFunction_minimumDiameter f = new FilterFunction_minimumDiameter(); assertEquals(1, f.getFunctionName().getArgumentCount()); }
/** Test of getArgCount method, of class FilterFunction_minimumCircle. */ @Test public void testGetArgCount() { FilterFunction_minimumCircle f = new FilterFunction_minimumCircle(); assertEquals(1, f.getFunctionName().getArgumentCount()); }
/** Test of getArgCount method, of class FilterFunction_octagonalEnvelope. */ @Test public void testGetArgCount() { FilterFunction_octagonalEnvelope f = new FilterFunction_octagonalEnvelope(); assertEquals(1, f.getFunctionName().getArgumentCount()); }
/** Test of getArgCount method, of class FilterFunction_minimumRectangle. */ @Test public void testGetArgCount() { FilterFunction_minimumRectangle f = new FilterFunction_minimumRectangle(); assertEquals(1, f.getFunctionName().getArgumentCount()); }
@Test public void testGetArgCount() { // System.out.println(" getArgCount"); EnvFunction fn = new EnvFunction(); assertEquals(1, fn.getFunctionName().getArgumentCount()); }
/** Test of getArgCount method, of class FilterFunction_strURLEncode. */ @Test public void testArgCount() { URLEncodeFunction f = new URLEncodeFunction(); assertEquals(-1, f.getFunctionName().getArgumentCount()); }
public void testParse() throws Exception { FilterMockData.functionName(document, document); FunctionName function = (FunctionName) parse(OGC.FunctionNameType); assertEquals("foo", function.getName()); assertEquals(2, function.getArgumentCount()); }
public void testParse() throws Exception { FilterMockData.functionName(document, document); FunctionName function = (FunctionName) parse(OGC.Function_NameType); assertEquals("foo", function.getName()); assertEquals(2, function.getArgumentCount()); }
@Test public void testHigherCardinality() { FunctionName name = new FunctionNameImpl( "test", parameter("result", Double.class), parameter("double", Double.class, 2, 2)); FunctionExpressionImpl f = new FunctionExpressionImpl(name) {}; assertEquals(2, f.getFunctionName().getArgumentCount()); }
@Test public void testVariableArgCount() { FunctionName name = new FunctionNameImpl( "test", parameter("result", Double.class), parameter("double", Double.class, 2, Integer.MAX_VALUE)); FunctionExpressionImpl f = new FunctionExpressionImpl(name) {}; assertEquals(-2, f.getFunctionName().getArgumentCount()); }
public void testrandom() { try { FilterFunction_random randomFunction = (FilterFunction_random) ff.function("random", new org.opengis.filter.expression.Expression[0]); assertEquals("Name is, ", "random", randomFunction.getName()); assertEquals( "Number of arguments, ", 0, randomFunction.getFunctionName().getArgumentCount()); } catch (FactoryRegistryException e) { java.util.logging.Logger.getGlobal().log(java.util.logging.Level.INFO, "", e); fail("Unexpected exception: " + e.getMessage()); } }
@Test public void testSimpleArguments() { FunctionName name = new FunctionNameImpl( "test", parameter("result", Double.class), parameter("one", Double.class), parameter("two", Double.class)); FunctionExpressionImpl f = new FunctionExpressionImpl(name) {}; assertEquals(2, f.getFunctionName().getArgumentCount()); } }